des commandes unix trop cool
- lister tous les projets d'un dossier contenant des fichiers .py
ls -lR ./*/*py | cut -d'/' -f2 | uniq
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 |
#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' |
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 |
#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 |
port=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()') |
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 |
#!/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 |
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' |