Skip to content

Instantly share code, notes, and snippets.

@starenka
starenka / wtf.py
Created March 13, 2012 16:26
2+2=5
In [1]: def foo(foo,bar,baz=None): pass
In [2]: foo('bar',baz='foo')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/<ipython-input-2-bdb4909afb85> in <module>()
----> 1 foo('bar',baz='foo')
TypeError: foo() takes at least 2 arguments (2 given)
@starenka
starenka / core.py
Created March 13, 2012 20:11 — forked from kracekumar/core.py
parallelpip demo
#! -*- Coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import gevent
import time
from envoy import run
from sys import exit, argv
import subprocess
import pip
@starenka
starenka / exc.py
Created March 13, 2012 21:14
replacing exception hook to catch all excpetion w/ messing the code
#!/usr/bin/env python
import sys
def catch_all(exc_type, exc_value, traceback):
sys.stderr.write('[!] %s\n'%exc_value)
sys.excepthook = catch_all
if __name__ == '__main__':
raise RuntimeError('CAN I HAZ COOKIE?')
@starenka
starenka / _hg
Created March 29, 2012 22:57 — forked from yuitowest/_hg
Zsh completion script for mercurial
#compdef hg
# Zsh completion script for mercurial. Rename this file to _hg and copy
# it into your zsh function path (/usr/share/zsh/site-functions for
# instance)
#
# If you do not want to install it globally, you can copy it somewhere
# else and add that directory to $fpath. This must be done before
# compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
# file could look like this:
Uncaught exception: SyntaxError: JSON.parse: Colon expected: recentl
Error thrown at line 30, column 62976 in <anonymous function>(a) in https://twimg0-a.akamaihd.net/c/phoenix/en/bundle/t1-core.a65a5e07efea1d7bcdd8b5a1f5166b3b.js:
twttr.cache.Simple.call(this),this._namespace=a,this._cache=JSON.parse(v(a)||"{}"),twttr.cache.LocalProvider._caches.push(this)
called via Function.prototype.apply() from line 20, column 122264 in <anonymous function: klass>() in https://twimg0-a.akamaihd.net/c/phoenix/en/bundle/t1-core.a65a5e07efea1d7bcdd8b5a1f5166b3b.js:
c.apply(this,arguments),twttr.each(d,function(a){new a(f,b)})
called from line 30, column 63886 in <anonymous function>(a) in https://twimg0-a.akamaihd.net/c/phoenix/en/bundle/t1-core.a65a5e07efea1d7bcdd8b5a1f5166b3b.js:
this.name=a,this.cache=new twttr.cache.LocalProvider(":USER:"),this.user=this.cache.get(a)||this.cache.set(a,{login:(new Date).getTime(),store:{}}),this.clean()
called via Function.prototype.apply() from line 20, column 122264 in <ano
starenka /tmp % cat meh.py [90% 05:31:21]
import sys
try:
fap()
except Exception, e:
exc, mess, tb = sys.exc_info() #<-tady si ji ulozim
#tady si ji vypisu
import traceback
starenka /tmp % cat meh.py [85% 05:12:53]
import logging
try:
fap()
except Exception, e:
logging.exception('Abandon ship!!!')
starenka /tmp % python meh.py [85% 05:14:08]
ERROR:root:Abandon ship!!!
starenka /tmp % cat meh.py [77% 04:46:58]
try:
fap()
except Exception as e:
import traceback
traceback.print_tb(e.__traceback__)
print(str(e))
print(repr(e))
starenka /tmp % python3.2 meh.py [77% 04:47:11]
@starenka
starenka / phpfcgi.py
Created May 4, 2012 15:08
scans given urls for php/fcgi CVE-2012-1823 vuln
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pip install requests gevent
import os, sys
from optparse import OptionParser
from requests import async
@starenka
starenka / athletes
Created July 31, 2012 18:57
scrapes all athletes for given country (London 2012)
#!/usr/bin/env python
import string, sys
import requests
from pyquery import PyQuery as pq
country = sys.argv[1] if len(sys.argv) > 1 else 'czech-republic'
for letter in string.uppercase:
doc = pq(requests.get('http://www.london2012.com/country/%s/athletes/initial=%s/index.html' % (country, letter)).content)