Skip to content

Instantly share code, notes, and snippets.

View public's full-sized avatar
🏠
Working from home

Alex Stapleton public

🏠
Working from home
View GitHub Profile
In [1]: import restpose
In [2]: r = restpose.Server('http://localhost:7777')
In [3]: d = {"artists|Artist": {"info": {"type": "text", "group": "n"}, "score": {"slot": 0, "type": "double"}, "name": {"type": "text", "group": "n", "wdfinc": 5}}}
In [4]: core = r.collection("core")
In [5]: core.checkpoint().wait()
Out[5]: <restpose.client.CheckPoint object at 0x4346c90>
import restpose
r = restpose.Server('http://localhost:7777')
d = {"artists|Artist": {"info": {"type": "text", "group": "n"}, "score": {"slot": 0, "type": "double"}, "name": {"type": "text", "group": "n", "wdfinc": 5}}}
core = r.collection("core")
core.checkpoint().wait()
conf = core.config
conf["types"].update(d)
conf["types"]
core.config = conf
core.checkpoint().wait()
@public
public / gist:2917007
Created June 12, 2012 11:34
1080p display. No video (once KMS kicks in?)
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.4.2-030402-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201206091355 SMP Sat Jun 9 17:56:02 UTC 2012
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.4.2-030402-generic root=UUID=c01f5b9d-6514-493a-872c-74bdee03da46 ro crashkernel=384M-2G:64M,2G-:128M nosplash drm.debug=0xe
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
@public
public / gist:2917021
Created June 12, 2012 11:37
1080i display. Everything works fine.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.4.2-030402-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201206091355 SMP Sat Jun 9 17:56:02 UTC 2012
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.4.2-030402-generic root=UUID=c01f5b9d-6514-493a-872c-74bdee03da46 ro crashkernel=384M-2G:64M,2G-:128M nosplash drm.debug=0xe
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
@public
public / gist:2917518
Created June 12, 2012 13:30
1080p display. No video (once KMS kicks in?) with drm-intel-next-queued 172cf15d kernel
Jun 12 14:24:17 htpc kernel: [ 0.000000] Initializing cgroup subsys cpuset
Jun 12 14:24:17 htpc kernel: [ 0.000000] Initializing cgroup subsys cpu
Jun 12 14:24:17 htpc kernel: [ 0.000000] Linux version 3.3.0-rc1drm-intel-next-fdo36515cmt22-generic (root@tangerine) (gcc version 4.6.2 (Ubuntu/Linaro 4.6.2-12ubuntu1) ) #fdo36515cmt22 SMP Fri Feb 3 15:25:06 UTC 2012
Jun 12 14:24:17 htpc kernel: [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.3.0-rc1drm-intel-next-fdo36515cmt22-generic root=UUID=c01f5b9d-6514-493a-872c-74bdee03da46 ro crashkernel=384M-2G:64M,2G-:128M nosplash drm.debug=0xe
Jun 12 14:24:17 htpc kernel: [ 0.000000] KERNEL supported cpus:
Jun 12 14:24:17 htpc kernel: [ 0.000000] Intel GenuineIntel
Jun 12 14:24:17 htpc kernel: [ 0.000000] AMD AuthenticAMD
Jun 12 14:24:17 htpc kernel: [ 0.000000] Centaur CentaurHauls
Jun 12 14:24:17 htpc kernel: [ 0.000000] BIOS-provided physical RAM map:
Jun 12 14:24:17 htpc kernel: [ 0.000000] BIOS-e820: 0000000000000000 - 00
@public
public / gist:3128438
Created July 17, 2012 09:50
Topographic view bookmarklet
javascript:(function()%7Bvar%20s=%22body%22,c=%22%22,I=%22%20!%20important;%22,i,b,f,x,h;%20for(i=0;i%3C17;++i)%20%7B%20x%20=%20i.toString(16);%20b%20=%20i%3E15?%22FCC%22:x+x+x;%20f%20=%20i%3E9?%22000%22:%22FFF%22;%20c%20+=%20s%20+%20%22%20%7Bbackground:%20%23%22%20+%20b%20+%20I%20+%20%22border-color:%20%23%22%20+%20b%20+%20I%20+%20%22color:%20%23%22%20+%20f%20+%20I%20+%20%22%7D%5Cn%22;%20s%20+=%20%22%20*%22;%20%7D%20if(document.createStyleSheet)%20%7B%20document.createStyleSheet(%22javascript:'%22+c+%22'%22);%20%7D%20else%20%7B%20h=document.createElement('link');%20h.rel='stylesheet';%20h.href='data:text/css,'+escape(c);%20document.getElementsByTagName(%22head%22)%5B0%5D.appendChild(h);%7D%7D)()
@public
public / gist:5030334
Created February 25, 2013 14:55
Stop GIF animations bookmarklet
javascript:function%20is_gif%28e%29%7Breturn/%5E(?!data:).*\.gif/i.test(e.src)}function%20stopgif(e){var%20t=document.createElement(%22canvas%22);var%20n=t.width=e.width;var%20r=t.height=e.height;t.getContext(%222d%22).drawImage(e,0,0,n,r);try{e.src=t.toDataURL(%22image/gif%22)}catch(i){for(var%20s=0,o;o=e.attributes[s];s++)t.setAttribute(o.name,o.value);e.parentNode.replaceChild(t,e)}}[].slice.apply(document.images).filter(is_gif).map(stopgif)
class Printer(object):
def __call__(*args):
print 'call', args
def __get__(*args):
print 'get', args
return args[0]
def print_stuff(*args):
print(args)
@public
public / gist:5170465
Last active December 15, 2015 00:08
Prevent loading of pyc files when the py file has disappeared.
import imp
import os
import os.path
import stat
import sys
class pycSanity(object):
def __new__(cls, *args):
obj = super(pycSanity, cls).__new__(cls)
obj.args = args
def block(func, args):
def decorator(f2):
return func(f2, args)
return decorator
@block(map, range(10))
def square(x):
return x**2