Skip to content

Instantly share code, notes, and snippets.

View pagenoare's full-sized avatar

Kacper Krupa pagenoare

View GitHub Profile
@pagenoare
pagenoare / zaprzyjaznione.cpp
Created December 3, 2009 21:36
Wyszukaj liczby zaprzyjaźnione z przedziału...
macbook $ time ./zaprzyjaznione
Podaj przedział: 1500
284 i 220 są liczbami zaprzyjaźnonymi
1210 i 1184 są liczbami zaprzyjaźnonymi
real 0m4.903s
user 0m3.616s
sys 0m0.000s
@pagenoare
pagenoare / thumbs.diff
Created January 21, 2010 22:28
better image quality in thumbs.py (django) -> http://djangothumbnails.com/
--- thumbs.py 2009-06-08 20:11:41.000000000 +0200
+++ thumbs2.py 2010-01-23 14:48:25.000000000 +0100
@@ -5,7 +5,7 @@
"""
from django.db.models import ImageField
from django.db.models.fields.files import ImageFieldFile
-from PIL import Image
+from PIL import Image, ImageFilter
from django.core.files.base import ContentFile
import cStringIO
@pagenoare
pagenoare / __init__.py
Created April 18, 2010 16:37
Fork of napi.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based on http://napi.py.googlepages.com/napi.py
import sys
import os
import hashlib
import sys
import urllib
# coding: utf-8
from django import forms
class Invite(forms.Form):
email = forms.EmailField(required=True)
@pagenoare
pagenoare / np.py
Created December 20, 2010 21:05
now-playing in py
import feedparser
user = 'pagenoare'
d = feedparser.parse('http://ws.audioscrobbler.com/1.0/user/%s/recenttracks.rss' % user)
title = d.entries[0].title.encode('utf-8')
print title
# coding: utf-8
import re
import mechanize
pattern = re.compile('<tr><th class="black tdl">W dniu <b>([^\<]+)</b> o godzinie <b>([^\<]+)</b> przyrost Twojego portfela wynosi</th><td class="money1">([^\%]+)%</td></tr>')
class SIGG(object):
def __init__(self):
self.browser = mechanize.Browser()
@pagenoare
pagenoare / actions.py
Created November 11, 2011 16:14
awesome pisi package
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2007 TUBITAK/UEKAE
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
from pisi.actionsapi import autotools
def setup():
@pagenoare
pagenoare / actions.py
Created November 11, 2011 16:15
libxdg-basedir pisi package [ dep for awesome wm ]
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2007 TUBITAK/UEKAE
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
@pagenoare
pagenoare / pary_1.txt
Created November 21, 2011 12:04
ARKUSZ_CZ_II; Zad. 6
222 22121
211 12020
12 21111
2010 20122
1222 12211
2021 20122
111 10221
2 10010
111 22211
122 10221
@pagenoare
pagenoare / zad1.py
Created November 28, 2011 11:55
random tasks
# coding: utf-8
def main():
try:
liczba = int(raw_input('Podaj liczbe: '))
except:
print 'podany wyraz to nie liczba!'
if (liczba % 2 == 0) and (liczba >= 4 and liczba <= 100000000):
i = [liczba / 2, liczba / 2]
if (not liczba_pierwsza(i[0])) and (not liczba_pierwsza(i[1])):