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
| # coding=utf8 | |
| # Copyright (C) 2011 Saúl Ibarra Corretgé <saghul@gmail.com> | |
| # | |
| __all__ = ['Database', 'DatabaseError'] | |
| from sqlobject import connectionForURI, sqlhub, SQLObject, StringCol | |
| from twisted.internet import reactor | |
| from twisted.internet.threads import deferToThread |
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
| from twisted.internet import reactor | |
| from eventlet.green import urllib2 | |
| from eventlet.twistedutil import join_reactor | |
| from datetime import datetime | |
| from sipsimple.util import run_in_green_thread | |
| @run_in_green_thread | |
| def bar(): |
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
| from application.python.util import Singleton | |
| from sylk.applications import ISylkApplication, sylk_application | |
| from zope.interface import implements | |
| @sylk_application | |
| class SkelApplication(object): | |
| __metaclass__ = Singleton | |
| implements(ISylkApplication) |
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
| In [2]: from dateutil.parser import parse | |
| In [3]: from datetime import datetime | |
| In [4]: now = datetime.now() | |
| In [5]: timestamp = now.isoformat() | |
| In [6]: print timestamp | |
| ------> print(timestamp) |
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
| In [20]: from datetime import datetime | |
| In [21]: from dateutil.tz import tzlocal | |
| In [22]: now = datetime.now(tzlocal()) | |
| In [23]: timestamp = now.replace(microsecond=0).isoformat() | |
| In [24]: print timestamp | |
| -------> print(timestamp) |
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
| In [26]: timestamp = '2011-02-01 01:05:00+01:00' | |
| In [27]: from dateutil.parser import parse as parse_datetime | |
| In [28]: dt = parse_datetime(timestamp) | |
| In [29]: print dt | |
| -------> print(dt) | |
| 2011-02-01 01:05:00+01:00 |
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
| In [39]: d1 = datetime.now() | |
| In [40]: d2 = datetime.now(tzlocal()) | |
| In [41]: d2-d1 | |
| --------------------------------------------------------------------------- | |
| TypeError Traceback (most recent call last) | |
| /home/saghul/work/<ipython console> in <module>() |
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 | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "You must be root" | |
| exit 1 | |
| fi | |
| if [[ $# -ne 3 ]]; then | |
| echo "Usage example: ./arpspoof.sh eth0 192.168.1.123 192.168.1.1" | |
| exit 1 |
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
| U +4.002042 192.168.99.36:46287 -> 81.23.228.161:5060 | |
| REGISTER sip:sip2sip.info SIP/2.0 | |
| Call-ID: a812225af963d74d1f448421baf0e935@192.168.99.36 | |
| CSeq: 3879 REGISTER | |
| From: "saghul" <sip:saghul@sip2sip.info:5060>;tag=578921570 | |
| To: "saghul" <sip:saghul@sip2sip.info:5060> | |
| Via: SIP/2.0/UDP 192.168.99.36:46287;branch=z9hG4bKe3516d385aa81d7768be12f905d7d1e6333939;rport | |
| Max-Forwards: 70 | |
| User-Agent: SIPAUA/0.1.001 | |
| Contact: "saghul" <sip:saghul@192.168.99.36:46287;transport=udp> |
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
| U +0.085305 192.168.99.36:60583 -> 81.23.228.146:5060 | |
| REGISTER sip:sip2sip.info:5060;maddr=node03.dns-hosting.info SIP/2.0 | |
| Call-ID: 2886516c9522d3e8f60702067e35e954@192.168.99.36 | |
| CSeq: 3404 REGISTER | |
| From: "saghul" <sip:saghul@sip2sip.info:5060>;tag=1294656353 | |
| To: "saghul" <sip:saghul@sip2sip.info:5060> | |
| Via: SIP/2.0/UDP 192.168.99.36:60583;branch=z9hG4bKfbf000b5535dc024e1bdaf7953e1d070333939;rport | |
| Max-Forwards: 70 | |
| User-Agent: SIPAUA/0.1.001 | |
| Contact: "saghul" <sip:saghul@192.168.99.36:60583;transport=udp> |