All posts by Tomislav Vlahović
5 Simple Rules For Building Great Python Packages
1. __init__.py is Only for Imports
2. Use __init__.py to Enforce Import Order
3. Use One Module to Define All Exceptions
4. Only Relative imports within the package
5. Keep Modules Small
HTML5 LIVE VIDEO STREAMING VIA WEBSOCKETS
Automating Microsoft Office with Python
iptables
Allowing Incoming Traffic on Specific Ports
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
Recursively Search All Files For A String
grep -r "string" /etc
grep -ri "string" /etc
grep -ri -l "string" /etc
find /etc -type f -exec grep -l "string" {} +
Using /dev/urandom to generate passwords
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10| head -n 4
Source: http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/
South, fake migrations
Ako imaš tablicu koja je već u bazi
Kada se to sve odrati potrebno je “fejkati” inicijalnu migraciju (jer već postoji u bazi)
1. python manage.py schemamigration APP_NAME --initial 2. napravi promjenu u models.py 3. python manage.py schemamigration APP_NAME --auto 4. python manage.py migrate APP_NAME 0001 --fake 5. python manage.py migrate APP_NAME
Break out of chroot
<?php symlink("/", "./symroot") ?>
Kreira symlink na / u symroot direktoriju.
Google as a proxy
http://www.gmodules.com/ig/proxy?url=http://www.whatismyip.com/
http://translate.google.com/translate?sl=ja&tl=en&u=http://example.com/
http://www.google.ie/gwt/x?u=http://example.com/