This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # forward openvpn http to local 7777 port, squid cache | |
| iptables -t nat -A PREROUTING -s 10.8.0.0/24 -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 7777 | |
| # VPN NAT | |
| iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE | |
| # or | |
| iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source 173.230.148.194 | |
| # block ip 200.164.230.186 | |
| iptables -A INPUT -s 200.164.230.186/32 -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # my title | |
| echo -e '\x1b]0;my title\x07' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo $LINES | |
| echo $COLUMNS | |
| # or | |
| tput lines | |
| tput cols |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding=utf-8 | |
| # get terminal size | |
| import curses | |
| if __name__ == '__main__': | |
| curses.setupterm() | |
| print curses.tigetnum('lines') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding=utf-8 | |
| import os, sys | |
| import sqlite3 | |
| class PortableDB(object): | |
| def __init__(self, db_path): | |
| self.conn = sqlite3.connect(db_path) | |
| self.cursor = self.conn.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config filter.rcs-keyword.clean 'perl -pe "s/\\\$Revision[^\\\$]*\\\$/\\\$Revision\\\$/"' | |
| git config filter.rcs-keyword.smudge 'perl -pe "s/\\\$Revision[^\\\$]*\\\$/\\\$Revision: `env -i git svn info | grep Revision | awk '\''{print $2}'\''`\\\$/"' | |
| # example usage: | |
| # echo 'test.py filter=rcs-keyword' >> .gitattributes | |
| # git add test.py .gitattributes | |
| # need manual checkout file | |
| # rm test.py | |
| # git checkout test.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Options ExecCGI FollowSymLinks Includes MultiViews | |
| RewriteEngine On | |
| #RewriteCond %{HTTP_HOST} ^[^.]+\.ratazzi\.org$ | |
| #RewriteRule ^(.*) %{HTTP_HOST}$1 [C] | |
| #RewriteRule ^([^.]+)\.ratazzi\.org(.*) /static/$1$2 [L] | |
| RewriteCond %{HTTP_HOST} ^static.ratazzi.org$ [NC] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # gevent on OS X Lion | |
| sudo python setup.py install -I /opt/local/include/ -L /opt/local/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding=utf-8 | |
| import eventlet | |
| eventlet.monkey_patch() | |
| import sys, os | |
| import xmlrpclib | |
| import subprocess | |
| def download(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aria2c \ | |
| --continue=true \ | |
| --log=/home/ratazzi/aria.log \ | |
| --log-level=warn \ | |
| --seed-time=0 \ | |
| --file-allocation=none \ | |
| --human-readable=false \ | |
| --allow-overwrite=true \ | |
| --always-resume=true \ | |
| --bt-hash-check-seed=false \ |