Skip to content

Instantly share code, notes, and snippets.

@L1ghtmann
L1ghtmann / sillyshit.sh
Last active December 4, 2025 05:05
Mount iDevice on Win and copy photos/videos off
#!/usr/bin/env bash
src="$HOME/iP"
target="$HOME/iPhotos"
if ! [[ -f /tmp/.s1 ]]; then
# There are a few of these commands that must be run first
# Relies on WSL+https://github.com/dorssel/usbipd-win
echo '
Please run the following in Powershell (Admin) and then restart your PC:
@L1ghtmann
L1ghtmann / setup-wsl.sh
Last active November 29, 2025 15:34
setup WSL
#!/bin/bash
if ! [[ -x $(command -v apt) ]]; then
echo "Only for Debian-based distros"
exit 0
fi
codename="$(grep 'PRETTY_NAME' /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p')"
if ! [[ -z $(cat /etc/apt/sources.list | grep "$codename") ]]; then
sudo sed -i "s/$codename/testing/g" /etc/apt/sources.list
fi
cat << 'EOF' >> ~/.profile
@L1ghtmann
L1ghtmann / setup-ish.sh
Last active November 29, 2025 15:26
iSH setup script
#!/bin/sh
suser="$(cat /etc/passwd | grep ish)"
if [ -z "$suser" ]; then
passwd
adduser ish
apk add sudo
echo "ish ALL=(ALL:ALL) ALL" >> /etc/sudoers
fi
user="$(whoami)"
if [ "$user" == "root" ]; then
@L1ghtmann
L1ghtmann / info.md
Last active November 28, 2025 23:10
Access WSL2 externally
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=$(wsl.exe hostname -I)

Purpose: forwards all incoming network traffic (0.0.0.0) on port 4000 to $(wsl.exe hostname -I) at the same port

  • view
netsh interface portproxy show all
  • delete
@L1ghtmann
L1ghtmann / local-git-cleanup.sh
Created August 23, 2023 23:15
Deletes local git repos with no remote equivalent (i.e., branches deleted remotely)
#!/usr/bin/env bash
set -e
# Accept 'D' flag
while getopts ":D:" flag; do
case "$flag" in
# Assign the arg associated with -D to $directory
D) directory="$OPTARG" ;;
*) echo "$0: Option -$OPTARG requires an argument." 1>&2
@L1ghtmann
L1ghtmann / Guide.md
Created July 8, 2023 03:45
Theos App -> Xcode App

Theos app to Xcode-compatible app:

Choose:

  • Xcode Proj Template: iOS > App
  • Interface - storyboard
  • Language - language you wrote the app in (swift or objc)

In target settings that appear after choosing creation dir:

  • Info > Delete 'Application Scene Manifest' and 'Main storyboard file base name'
  • Build Phases > add required libraries, frameworks, etc as listed in Theos proj makefile
@L1ghtmann
L1ghtmann / org-contributors.go
Last active February 16, 2023 03:10
Get a list of contributors to a public GitHub org sorted by total diff
package main
//
// org-contributors.go
// Created by Lightmann
// February 2023
//
import (
"os"
@L1ghtmann
L1ghtmann / org-contributors.py
Created February 14, 2023 02:31
Get a list of contributors to a public GitHub org sorted by total diff
#!/usr/bin/env python3
#
# org-contributors.py
# Created by Lightmann
# February 2023
#
import subprocess, tempfile, argparse, sys, os, re
def help_prompt():
@L1ghtmann
L1ghtmann / org-contributors.pl
Last active February 13, 2023 21:40
Get a list of contributors to a public GitHub org sorted by total diff
#!/usr/bin/env perl
#
# org-contributors.pl
# Created by Lightmann
# February 2023
#
use strict;
use warnings;
use FindBin;