Skip to content

Instantly share code, notes, and snippets.

View sebw's full-sized avatar
🤠

Sebastien Wains sebw

🤠
View GitHub Profile
@sebw
sebw / gist:5928686
Created July 4, 2013 15:38
Analyze tcpdump trafic remotely (in this case LDAP)
ssh root@dest tcpdump -U -s0 -w - 'tcp port 389' | wireshark -k -i -
@sebw
sebw / gist:5940442
Created July 6, 2013 16:39
Python web server
python -m SimpleHTTPServer 80
@sebw
sebw / gist:5957820
Created July 9, 2013 14:34
awk : print every 20th line in the file data.txt
awk '(NR%20==0)' data.txt
NF The number of fields in the current input record.
NR The total number of input records seen so far.
@sebw
sebw / iteration.py
Last active May 2, 2019 20:46
Python iteration through dict
d = {'site1': {'servername': 'test.org', 'serveralias': 'www.test.org'}}
for key, value in d.iteritems():
print key
print value['servername']
@sebw
sebw / openssl-key.txt
Created July 17, 2013 07:06
OpenSSL self sign certificate
Private key : openssl genrsa -out ssl.key 1024
Certificate : openssl req -new -x509 -days 3650 -key ssl.key -out ssl.crt
Verification : openssl x509 -in ssl.crt -text -noout
@sebw
sebw / gist:6018296
Created July 17, 2013 07:08
Manipulate image metadata (EXIF, IPTC)
find -name 'IMG*.JPG' | while read PIC; do DATE=$(exiftool -p '$DateTimeOriginal' $PIC |
sed 's/[: ]//g'); touch - t $(echo $DATE | sed 's/\(..$\)/\.\1/') $PIC;echo "Date:" $DATE "- " $PIC; mv -i $PIC $(dirname $PIC)/`date +%Y%m%d_%T`_$DATE.jpg; done
Renommer :
exit2 -t *.jpg
exiv2 -r Description_%Y%m%d_%H%M%S *.jpg
Ajouter copyright
exiftool -copyright="John Doe" *.jpg
@sebw
sebw / gist:6018298
Created July 17, 2013 07:09
Debian APT with /tmp as noexec
/etc/apt/apt.conf.d/50tmp
APT
{
ExtractTemplates
{
TempDir "/var/tmp";
};
};
@sebw
sebw / gist:6018328
Created July 17, 2013 07:14
SSH client configuration
Host *
ForwardAgent yes
# With Windows DC as DNS --> no
GSSAPIAuthentication no
AddressFamily inet
IdentityFile ~/.ssh/id_rsa
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIDelegateCredentials no
EscapeChar ~
@sebw
sebw / gist:6018335
Created July 17, 2013 07:15
Mac OS X : change default location for screenshots
defaults write com.apple.screencapture location /Full/Path/To/Folder
@sebw
sebw / gist:6018339
Created July 17, 2013 07:16
Debian APT not installing recommended packages
In /etc/apt/apt.conf
APT::Install-Recommends "0";