Skip to content

Instantly share code, notes, and snippets.

View lah7's full-sized avatar

Luke Horwell lah7

View GitHub Profile
@fabiomaggio
fabiomaggio / git-filter-branch-move-files.md
Last active October 20, 2022 08:48
Use git filter-branch to move all projects files to a subdir and rewrite all commits
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
  • Existing tags are updated
@z3ntu
z3ntu / gist:c5ca8f6040d8934fafc5e686b234890e
Last active October 28, 2023 20:39
openrazer fake driver commands
# one tab
mkdir -p /tmp/daemon_stuff/{,data,logs}; mkdir -p /tmp/daemon_test
./scripts/create_fake_device.py --dest /tmp/daemon_test --all
./scripts/create_fake_device.py --dest /tmp/daemon_test razerdeathadderchroma
# other tab
systemctl --user stop openrazer-daemon.service
openrazer-daemon -F --verbose --run-dir /tmp/daemon_stuff/data --log-dir /tmp/daemon_stuff/logs --test-dir /tmp/daemon_test
# run from source from testdata
PYTHONPATH="pylib:daemon" python3 ./daemon/run_openrazer_daemon.py -Fv --run-dir /tmp/daemon_stuff/data --log-dir /tmp/daemon_stuff/logs --test-dir /tmp/daemon_test --config=$PWD/daemon/resources/razer.conf
@manoj23
manoj23 / ubuntu-on-archlinux-using-lxc.md
Last active January 26, 2024 01:22
Install Ubuntu containers on Archlinux using LXC

Install Ubuntu containers on Archlinux using LXC

Install the lxc and the debootstrap packages:

# pacman -Sy lxc debootstrap 

Install an Ubuntu container

I will install Ubuntu 16. Therfore, I will use the xenial release.

@whistler
whistler / import.sh
Created March 16, 2015 17:31
Copy files to another repository while saving git history
# copied from http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
git clone <git repository A url> # clone source repository
cd <git repository A directory>
git remote rm origin # to make sure it doesn't affect the original repository
git filter-branch --subdirectory-filter <directory 1> -- --all # remove all files other than the ones needed
mkdir <directory 1> # move them into another directory where they will be stored in the destination repository (if needed)
mv * <directory 1>
git add .
git commit
@cdown
cdown / gist:5c5b53e1855d7812dfbc
Last active October 30, 2024 15:12
Debian chroot inside Arch
pacman -S wget # needed for debootstrap
curl -o /tmp/db.deb http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.60~bpo70+1_all.deb
mkdir /opt/debootstrap
cd /opt/debootstrap
ar x /tmp/db.deb
tar xf data.tar.gz
mkdir /opt/debian
@gitaarik
gitaarik / git_submodules.md
Last active May 4, 2026 00:53
Git Submodules basic explanation

Git Submodules - Basic Explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@Burgestrand
Burgestrand / README.md
Created February 3, 2012 23:20
A ruby script to construct magnet links out of .torrent files

Magneto

It reads your torrents. Spit out magnet URIs.

Example Usage

$ ./magneto.rb magneto.rb.torrent

Results in: