Skip to content

Instantly share code, notes, and snippets.

@starenka
starenka / about.md
Created August 30, 2012 20:12 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@starenka
starenka / g.sh
Created August 23, 2012 22:18
shell script to open a new tab with googled term and switch to browser (opera + awesome)
#!/bin/bash
opera --remote "openURL(g $*,new-page)" > /dev/null
echo "awful.tag.viewonly(tags[mouse.screen][4])" | awesome-client
@starenka
starenka / menu.ini
Created August 20, 2012 21:39
opera menu item for calling custom app with url
[Link Popup Menu]
...
Item, "Show Redirects" = Go to page, "javascript:(function(){window.open('http://redirects.lo/url='+encodeURIComponent('%l/'), '_blank', 'width=600,height=500');})()"
...
@starenka
starenka / showredirects.py
Created August 20, 2012 21:38
shows full redirect path for given url
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from flask import Flask
import requests
app = Flask(__name__)
app.debug = False
-- Keyboard layout switching
kbdcfg = {
cmd = "setxkbmap",
layout = { "us", "cz -variant qwerty" },
current = 1,
widget = widget({ type = "textbox", align = "right" })
}
kbdcfg.switch = function()
kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
local t = " " .. kbdcfg.layout[kbdcfg.current] .. " "
@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)
@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 /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 /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 [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