Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / .Xmodmap
Created September 8, 2022 09:17
linux/ubuntu disable next/previous mouse clicks/buttons
# ~/.Xmodmap
# disable next/previous mouse clicks
pointer = 1 2 3 4 5 6 7 0 0
@gmolveau
gmolveau / mount_lvm_usb.sh
Last active March 24, 2023 23:19
linux/lvm mount external USB LVM partition
sudo vgscan
# note vg name
sudo vgchange -ay <VG-NAME>
sudo lvdisplay
# note `LV Path`
sudo mkdir -p /media/usb/lvm_usb
sudo mount <LV-PATH> /media/usb/lvm_usb
# to automount this partition
sudo nano /etc/fstab
@gmolveau
gmolveau / fix-vgname.sh
Created August 23, 2022 15:09
linux/lvm fix duplicate vg names with vgrename uuid
sudo vgdisplay
# note UUID
sudo vgrename <UUID> <new-vg-name>
# done.
@gmolveau
gmolveau / spotlight_index_reset.sh
Created August 23, 2022 07:12
macos spotlight index reset
sudo mdutil -Ea
sudo mdutil -ai off
sudo mdutil -ai on
@gmolveau
gmolveau / docker_run_cypress_x11.sh
Created July 27, 2022 13:35
linux/ubuntu docker run cypress with x11 forwarding xhost
xhost +local:docker
docker run --rm -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e XAUTHORITY=/.Xauthority -v $HOME/.Xauthority:/.Xauthority --entrypoint cypress cypress/included:10.3.0 open --project .
@gmolveau
gmolveau / git-rimraf
Created July 7, 2022 12:50
git-rimraf : delete branches that don't exist on remote
#!/bin/bash
git fetch -p && (git for-each-ref --format='%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' refs/heads; git for-each-ref --format "%(refname:short) %(upstream)" refs/heads | awk '{if (!$2) print $1;}') | grep -E -v 'master|main|develop' | xargs echo git branch -D
# explanation
# - `git fetch -p` : fetch branches that no longer exist on remote
# - `git for-each-ref --format='%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' refs/heads` : list all branches that no longer exist on remote
# - `git for-each-ref --format "%(refname:short) %(upstream)" refs/heads | awk '{if (!$2) print $1;}'` : list all branches without a remote
# - `grep -E -v 'master|main|develop'` : remove master, main, develop branches from the results
# - `xargs echo git branch -D` : print the commande to delete those branches (remove echo if you want to exec this command directly)
@gmolveau
gmolveau / todo.txt
Created June 29, 2022 21:43
todo.txt format
x (A) 2015-05-20 2016-04-30 measure space for +chapelShelving @chapel due:2016-05-30
│ │ │ │ │ │ └─ Special key/value tag
│ │ │ │ │ └─ Context tag
│ │ │ │ └─ Project tag
│ │ │ └─ Optional - Creation date
│ │ └─ Optional - Completion date
│ └─ Optional - Marks priority
└─ Optional - Marks completion
> https://github.com/todotxt/todo.txt#todotxt-format-rules=
@gmolveau
gmolveau / hellfest_2022.md
Last active June 29, 2022 07:37
Hellfest 2022
@gmolveau
gmolveau / python_mock.md
Created June 23, 2022 08:11
“Don’t Mock What You Don’t Own” in 5 Minutes #python