Skip to content

Instantly share code, notes, and snippets.

@starenka
starenka / runserver-lighttpd
Created Jun 13, 2011
symlinks all django static files to lighttpd root
View runserver-lighttpd
#!/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 Jun 13, 2011
/etc/lighttpd/conf-enabled/django-static-proxy.conf
We couldn’t find that file to show.
@starenka
starenka / randomator.pl
Created Jul 31, 2011
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'
View randomator.pl
# 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 Aug 5, 2011
greps menus of my fav restaurants close to my office
View papu.py
#!/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 Aug 13, 2011
gets page likes and category via fb api
View facepalm.py
#!/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"
View nomnom.py
#!/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]
View gist:1161007
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 Aug 24, 2011
gets common followers stats for twitter accounts
View .gitignore
*.pyc
.idea/*
@starenka
starenka / Y-U-NO-HTML.py
Created Sep 15, 2011
Aktuální Respekt v HTML
View Y-U-NO-HTML.py
# 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 Sep 18, 2011
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
View .gitignore
.idea/*
*.pyc