Skip to content

Instantly share code, notes, and snippets.

@starenka
starenka / runserver-lighttpd
Created June 13, 2011 17:16
symlinks all django static files to lighttpd root
#!/usr/bin/env bash
LIGHTTPD_ROOT='/django/__proxy__/'
DIRS=( "static" "site_media" "site-media" )
OK_COLOR="\e[0;32m"
INFO_COLOR="\e[1;33m"
RESET="\033[0;0m"
echo -e "$INFO_COLOR Checking symlinks...$RESET"
@starenka
starenka / gist:1023229
Created June 13, 2011 17:20
/etc/lighttpd/conf-enabled/django-static-proxy.conf
We couldn’t find that file to show.
@starenka
starenka / randomator.pl
Created July 31, 2011 11:53
Sets a random message on pidgin start (or plugin acivation). Please place your message file named randomator.txt into ~/.purple/plugins. Each line is a 'status message'
# randomator plugin for Pidgin / libpurple
# @author starenka moc.liamg@0aknerats (backwards) 2008
use Purple;
%PLUGIN_INFO = (
perl_api_version => 2,
name => "randomator",
version => "0.1",
summary => "Sets a random message on pidgin start.",
@starenka
starenka / papu.py
Created August 5, 2011 23:45
greps menus of my fav restaurants close to my office
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from pyquery import PyQuery as pq
doc = pq(url='http://www.jinakrajina.cz/cz/poledni-menu')
noms = doc.find('td > p')
print '\n%s'%noms[0].text_content()[2:]
for i,nom in enumerate(noms[1:-1:2],1):
print '[%d] %s'%(i,nom.text_content().strip())
@starenka
starenka / facepalm.py
Created August 13, 2011 16:51
gets page likes and category via fb api
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @depends: pip install git+git://github.com/facebook/python-sdk.git#egg=facebook
import sys, time, datetime, csv, logging, os
from optparse import OptionParser
import facebook
usage = "python facepalm.py -i /where/to/get/input/file"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
RE_SPLIT = re.compile(r'\W+')
file_obj = open('/junk/in')
def parse_file(file_obj,re_split):
for line in file_obj:
yield re.split(re_split,line)[1:-1]
activities = (
{'freq':4,'texts':['Spím',
'Zdá se mi o pytlíku slunečnicovejch semínek',
'Odpočívám',
'Nabírám energii na další spánek dne']},
{'freq':3,'texts':['Hlodám',
'Koušu kabel. Nedáš si taky?',
'Zírám do blba',
'Čenichám',
'Snifuju',
@starenka
starenka / .gitignore
Created August 24, 2011 23:53
gets common followers stats for twitter accounts
*.pyc
.idea/*
@starenka
starenka / Y-U-NO-HTML.py
Created September 15, 2011 14:18
Aktuální Respekt v HTML
# Scrapuje Respekt.cz, aby to shráblo aktuální číslo v HTML.
# Nestahuje to obrázky, ale vidět jsou, protože maj absolutní URL,
# tohle se dá spravit pomocí pář řádků.
#
# Bohužel hapruje diakritika, bude tam někde potřeba pořešit přes iconv nebo tak něco.
import mechanize
from pyquery import PyQuery as pq
usr = "username"
@starenka
starenka / .gitignore
Created September 18, 2011 20:02
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
.idea/*
*.pyc