Skip to content

Instantly share code, notes, and snippets.

@iivvoo
iivvoo / ws.py
Last active January 5, 2020 15:03
A simple pythonscript to encode ascii text to whitespace and back
#!/usr/bin/env python3
import sys
spaces = " \u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000"
def encode(s):
res = ""
for c in s:
c = ord(c)
class A:
class B:
def __init__(self):
pass
class C(A.B):
def __init__(self):
super().__init__()
def classproperty(f):
"""
E.g.
>>> class foo(object):
... @classproperty
... def name(cls):
... return cls.__name__
>>> print foo.name
'foo'
"""
import time
import pprint
from empyrean.api import IPCAPI
from keys import address, passphrase
api = IPCAPI("/home/ivo/.ethereum/geth.ipc")
res = api.personal.unlockAccount(address, passphrase)
class EmberDateField(serializers.DateField):
def to_internal_value(self, value):
value = value.split('T', 1)[0]
return super().to_internal_value(value)
def to_representation(self, value):
res = super().to_representation(value)
# XXX This is a hack - assumes CET timezone, which is 1 hour
{"error":"{{case_clause,{{badmatch,{error,eacces}},\n [{couch_file,init,1,[{file,\"couch_file.erl\"},{line,314}]},\n {gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,304}]},\n {proc_lib,init_p_do_apply,3,\n [{file,\"proc_lib.erl\"},{line,239}]}]}},\n [{couch_server,handle_info,2,[{file,\"couch_server.erl\"},{line,442}]},\n {gen_server,handle_msg,5,[{file,\"gen_server.erl\"},{line,604}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,239}]}]}","reason":"{gen_server,call,\n [couch_server,\n {open,<<\"dick_cdb\">>,\n [{user_ctx,\n {user_ctx,null,\n [<<\"_admin\">>],\n <<\"{couch_httpd_auth, default_authentication_handler}\">>}}]},\n infinity]}"}
old-style
- name: Run buildout {{buildout}}
command: $venv/bin/buildout -N -c $buildout
chdir=$dest
new-style with {{}}
- name: Run buildout {{buildout}}
command: "{{venv}}/bin/buildout -N -c {{buildout}}"
@iivvoo
iivvoo / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am iivvoo on github.
  • I am iivvoo (https://keybase.io/iivvoo) on keybase.
  • I have a public key whose fingerprint is 3605 78AB 672C F459 3972 B796 9A30 7449 CF67 40A8

To claim this, I am signing this object:

from wheelcms_axle.auth import lr, local_roles
from quanza_ci.organization import OrganizationType, Membership
from quanza_ci.roles import employee
def org_lr(obj, request=None):
if Membership.objects.filter(user=request.user, organization=obj.instance).exists():
return [employee]
return []
lr.register(local_roles, [OrganizationType], org_lr)
@iivvoo
iivvoo / gist:6824444
Created October 4, 2013 11:20
django-simple-captcha configuration
CAPTCHA_FONT_SIZE=30
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
CAPTCHA_LETTER_ROTATION = (-10,10)