Skip to content

Instantly share code, notes, and snippets.

View pagenoare's full-sized avatar

Kacper Krupa pagenoare

View GitHub Profile
print sum([1 for number in open('tel.txt').readlines() if number[0:3] == '511'])
# 100 loops, best of 3: 1.65 ms per loop
In [15]: import re
In [16]: pattern = re.compile('\(.*\)')
In [17]: %timeit pattern.search(string)
1000000 loops, best of 3: 1.04 µs per loop
In [18]: %timeit '(' in string and ')' in string
1000000 loops, best of 3: 260 ns per loop
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import random
import urllib2
from urllib import urlencode
import irssi
#!/usr/bin/python
# -*- coding: utf-8 -*-
import irssi
import feedparser
username = 'pagenoare'
def nowplaying(data, server, witem):
d = feedparser.parse('http://ws.audioscrobbler.com/2.0/user/%s/recenttracks.rss' % username)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import irssi
import feedparser
username = 'pagenoare'
p_title = ''
def checker():
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pygnite import *
@get('/')
def index(request):
index.headers = { 'Content-type' : 'text/plain' }
# index.status = 200
return 'Hello world'
application: juno
version: 1
runtime: python
api_version: 1
handlers:
- url: .*
script: main.py
Index: gluon/restricted.py
===================================================================
--- gluon/restricted.py (wersja 989)
+++ gluon/restricted.py (kopia robocza)
@@ -77,7 +77,8 @@
cPickle.dump(d, open(os.path.join(errors_folder, f), 'wb'))
- return '%s/%s' % (a, f)
+ #return '%s/%s' % (a, f)
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pygnite import *
@get('/all/#:page?')
def index(request):
return 'Hello world'
#127.0.0.1 - - [05/Jul/2009 21:14:48] "GET /all/aa HTTP/1.1" 404 -
@pagenoare
pagenoare / .xinitrc
Created October 16, 2009 21:12
Xkb file for PL letters on macbook.
#!/bin/bash
xkbcomp $HOME/.Xkb $DISPLAY &> /dev/null
exec wmii