Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@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
@gmolveau
gmolveau / resize_ubuntu--vg-ubuntu--lv.sh
Created June 16, 2022 21:02
resize ubuntu--vg-ubuntu--lv / partition / sda3 to 100% of disk size
## source : https://packetpushers.net/ubuntu-extend-your-default-lvm-space/
# first, check
df -h
sudo lvdisplay
# extend
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# check that size is now correct
sudo lvdisplay
# resize
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
@gmolveau
gmolveau / git_pull_push_force.md
Created June 14, 2022 13:21
git pull after git push force
# after a git push -f or git push origin +master, use
git pull --rebase