Skip to content

Instantly share code, notes, and snippets.

View dpwiz's full-sized avatar
👁️‍🗨️
🌈

Alexander Bondarenko dpwiz

👁️‍🗨️
🌈
View GitHub Profile
@dpwiz
dpwiz / exitpoll.py
Created November 18, 2010 07:47
Crunch posts and do some math
from urllib2 import urlopen
from BeautifulSoup import BeautifulStoneSoup as Soup
NUM_PAGES = 73
BASE_URL = "http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1414376&page=%d"
TITLES = {
1: 'AFK/Busy/Available Indicator (CSM)',
2: 'Accessibility Focus Group',
3: 'Account Security Enhancements (CSM)',
@dpwiz
dpwiz / gist:727051
Created December 3, 2010 14:49
get t2 stuff which uses planetary stuff
InvType.objects.filter(pk__in=InvTypeMaterial.objects.filter(material_type__in=InvType.objects.filter(planetschematicstypemap__isnull=False).distinct().values_list('pk', flat=True)).distinct().values_list('type_id', flat=True), is_published=True).filter(dgmtypeattribute__attribute__name="metaLevel", dgmtypeattribute__value_int=5)
@dpwiz
dpwiz / buildenv.sh
Created February 28, 2011 19:02
Prepare to deploy stuff
mkdir -p reports
REPO="http://127.0.0.1:8888"
echo Checking for local repo at ${REPO}
curl -f --head ${REPO} > /dev/null 2>&1 || REPO='http://pypi.python.org/simple'
echo "... will use ${REPO}"
echo 'Creating "venv" environment...'
virtualenv --distribute --no-site-packages venv
@dpwiz
dpwiz / py-bootstrap.sh
Created March 23, 2011 14:42
Prepare baseline FreeBSD to host some python stuff
PORTS="editors/nano devel/git ftp/curl ftp/wget textproc/libxml2 www/nginx-devel"
EGGS="pip virtualenv mercurial"
if [ `pkg_info|grep python27|awk '{ print $1 }'` ]; then
echo Python 2.7 found.
if [ `pkg_info | grep py27-sqlite3 | awk '{ print $1 }'` ]; then
echo "sqlite3 is here, you're so cool!"
else
echo "sqlite3 would be installed"
PORTS="databases/py-sqlite3 ${PORTS}"
@dpwiz
dpwiz / strings-ru.xml
Created April 12, 2011 07:26
Russian translation for convorsation: https://convore.com/convorsation/translations/
<?xml version="1.0" encoding="utf-8"?>
<!-- russian language file
-->
<resources>
<!-- begin translate -->
<string name="activity_title_settings">Настройки</string>
<string name="activity_title_grouplist">Groups of %s</string>
<string name="activity_title_topiclist">Темы</string>
<string name="activity_title_messagelist">Сообщения</string>
@dpwiz
dpwiz / partial.py
Created May 25, 2011 12:33
Partial(dict) with extra helpers for nose
"""Partial(dict) with extra helpers for nose.
>>> data = {'spam': 'salad', 'sausage': 'spam', 'whatever': 42}
Check only what you care for:
>>> data == {'spam': 'salad'}
False
>>> data == Partial({'spam': 'salad'})
True
@dpwiz
dpwiz / farpassword.py
Created June 15, 2011 07:12
Decode FAR password
def decode(pwd):
"""Decode FAR password"""
pwd = [int(pwd[i:i+2], 16) for i in xrange(0, len(pwd), 2)]
print 'bytes:', pwd
seed = (pwd[0] ^ pwd[1]) | 0x50
print 'password:', ''.join(chr(pwd[i] ^ seed) for i in xrange(2, len(pwd)))
<!DOCTYPE html>
<html>
<head>
<title>Problems, writer?</title>
</head>
<body style="padding: 0px; margin: 0px; font: Droid; color: #222;">
<div style="width: 800px; margin: auto;">
<h1 style="font: 25pt;">Can't write? Try this:</h1>
@dpwiz
dpwiz / utils.py
Created July 15, 2011 07:49
xls stats from db
"""More specific helpers."""
from django.conf import settings
from django.core.mail.message import EmailMessage
from datetime import date, timedelta
import os
from core.extdb import ExtDB
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\moon]
"Colour0"="255,255,255"
"Colour1"="255,255,255"
"Colour2"="51,51,51"
"Colour3"="85,85,85"
"Colour4"="0,0,0"
"Colour5"="0,255,0"
"Colour6"="77,77,77"