This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
#!/bin/bash | |
opera --remote "openURL(g $*,new-page)" > /dev/null | |
echo "awful.tag.viewonly(tags[mouse.screen][4])" | awesome-client |
#!/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] .. " " |
#!/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) |
#!/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 |