Skip to content

Instantly share code, notes, and snippets.

View ricventu's full-sized avatar
💭
don't run this at home

Riccardo Venturini ricventu

💭
don't run this at home
View GitHub Profile
@ricventu
ricventu / PHP command line through Docker.md
Last active March 22, 2023 07:35
PHP command line through Docker

PHP command line through Docker

PHP

in .bashrc on in .zshrc insert:

function php() {
    docker run --rm --interactive --tty \
 --user $(id -u):$(id -g) \
@ricventu
ricventu / git-prune-merged-branches.md
Last active March 20, 2023 08:48
Git prune merged branches

Delete local merged branches

  git branch --merged | grep -v  "master\|main\|develop" | sed 's/origin\///' | xargs git branch -d 

Delete remote merged branches

  git branch -r --merged | grep -v  "master\|main\|develop" | sed 's/origin\///' | xargs -n 1 git push -d origin
@ricventu
ricventu / hook.sh
Created October 18, 2019 11:42
Laravel git pull hook
composer install --no-dev --prefer-dist
composer dump-autoload -o
php artisan queue:restart
npm install
npm run prod
@ricventu
ricventu / recordmydesktop.sh
Created April 20, 2018 10:26
Recording linux screen
recordmydesktop --no-cursor --display=:0 --fps 15 -o out.ogv --workdir /tmp/ --device "default:CARD=PCH"
@ricventu
ricventu / robo3t.mongodb.md
Created March 24, 2018 16:54
Robo 3T collection export
records = [];
var cursor = db.getCollection('foo').find({}, {});
while(cursor.hasNext()) {
    records.push(cursor.next())
}
print(tojson(records));
@ricventu
ricventu / virtualbox_linux_gest.md
Last active April 4, 2018 12:28
Virtualbox guest additons Ubuntu

Install VirtualBox Guest Additions

Ubuntu

sudo apt-get install dkms

Insert Guest Additions CD image and install it

sudo usermod -a -G vboxsf <username>
@ricventu
ricventu / nat.md
Created November 24, 2017 15:23
Ubuntu nat routing
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

iptables-save > /etc/network/iptables.rules

add in /etc/network/interface:

@ricventu
ricventu / ssh_socks.md
Last active October 16, 2018 08:08
ssh over socks

ssh over socks

Via ssh command line

Create socks

ssh -D 9999 -C <proxy server>

Connect ssh using socks

@ricventu
ricventu / wav2gms.sh
Created September 27, 2017 09:47
Bash command to convert .wav files to .gsm format compatible with Asterisk
for a in *.wav; do sox -v 0.3 "$a" -r 8000 -c1 "$a.gsm" resample -ql; done
@ricventu
ricventu / .vimrc
Last active June 1, 2019 08:09
Vim config file
" ~/.vimrc
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB