Skip to content

Instantly share code, notes, and snippets.

View remijouannet's full-sized avatar
🦆
.

Remi Jouannet remijouannet

🦆
.
View GitHub Profile
@remijouannet
remijouannet / clean_arch.sh
Created May 30, 2016 19:18
clean_arch.sh
sudo pacman -Syu
yaourt -Syua --noconfirm
yaourt --stats
yaourt -Rs $(cat remove.packages)
yaourt -Qm > remove.packages
yaourt -Qqen > remove.packages
yaourt -Syua --noconfirm
sudo pacman -R $(pacman -Qdtq)
sudo pacman -Scc
@remijouannet
remijouannet / docker_desktop.sh
Created May 21, 2016 14:32
docker_desktop.sh
#launch xfce in a container
Xephyr :1 -screen 1368x720 &
xhost +
docker run -e DISPLAY=:1 -v /tmp/.X11-unix/:/tmp/.X11-unix/ -it debian:jessie /bin/bash -c 'apt-get update && apt-get install -y xfce4 && xfce4-session'
@remijouannet
remijouannet / clean_docker.sh
Created May 18, 2016 21:25
clean_docker.sh
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker volume rm $(docker volume ls -qf dangling=true)
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
cd ..
rm -rf old-repository.git
@remijouannet
remijouannet / gpg.sh
Last active May 6, 2016 08:20
reminder gpg
#generate private/public key
gpg --gen-key
#export public key
gpg --armor --output key.gpg --export 'Bob'
#encrypt foo.txt
gpg --armor -e -r 'Alice' foo.txt
#encrypt from stdin
@remijouannet
remijouannet / one_line_port.sh
Created March 8, 2016 10:35
one_line_port.sh
port=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
@remijouannet
remijouannet / long_commands_are_long.md
Last active May 11, 2016 20:35
long_commands_are_long.md

tips

des commandes unix trop cool

  • lister tous les projets d'un dossier contenant des fichiers .py
ls -lR ./*/*py | cut -d'/' -f2 | uniq
git remote -v
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git fetch upstream
git checkout master
git merge upstream/master
#OR
@remijouannet
remijouannet / wake_up_rdp.sh
Last active December 7, 2015 14:02
wake_up_rdp.sh
#!/bin/bash
exitcode=1
timeout=0
wol=0
#if your like me and you have a second computer for windows at work :)
#change 00:00:00:00:00:00 for your remote mac address
ping CNU15555LF -c 1 || wol=1
@remijouannet
remijouannet / dirty.sql
Created December 1, 2015 12:27
dirty.sql
SELECT ticket.ref, ticket.status, ticket.start_date,
IF(ticket.last_communication != "",
str_to_date(TRIM(SUBSTRING_INDEX(ticket.last_communication, ':', 3)), '%Y-%m-%d %H:%i:%s'),
NULL) AS last_communication_date,
SUBSTRING( ticket.last_communication,
LOCATE('Prochain suivi : ', ticket.last_communication) + 17,
(LOCATE('\n', SUBSTRING(ticket.last_communication, LOCATE('Prochain suivi : ', ticket.last_communication)))
+ LOCATE('Prochain suivi : ', ticket.last_communication) - LOCATE('Prochain suivi : ', ticket.last_communication)) - 17 ) AS next_communication,
CASE
WHEN ticket.last_communication regexp BINARY 'OUVERTURE' THEN 'OUVERTURE'