This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xml.etree import ElementTree as etree | |
from functools import partial | |
Circle = partial(etree.Element, 'svg:circle') | |
c = Circle(cx='100', cy='200', fill='red') | |
etree.tostring(c) | |
# <svg:circle cx="100" cy="200" fill="red" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ParametricPlot3D[{(3+cos(v)) * cos(u),(3+cos(v)) * sin(u), sin(v)},{u,0,2pi},{v,0,2pi}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from ctypes import * | |
import time, random | |
import os | |
CURRENTWINDOW = 0 | |
# nm -D /usr/lib64/libxdo.so.2 | grep mouselocation | |
# http://python.net/crew/theller/ctypes/tutorial.html#passing-pointers-or-passing-parameters-by-reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import json,sys; print json.load(sys.stdin)" < input.txt | |
cat unformatted.json | python -m json.tool > formatted.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prman -statsfile FOO.xml BAR.rib | |
from lxml import etree | |
root = etree.parse('stats.xml').getroot() | |
print root.xpath("//set[@name='fileLog']/member/text()") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename F> | |
struct ScopeExit { | |
ScopeExit(F f) : f(f) {} | |
~ScopeExit() { f(); } | |
F f; | |
}; | |
template <typename F> | |
ScopeExit<F> MakeScopeExit(F f) { | |
return ScopeExit<F>(f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
im = Image.open("color.png") | |
im.split()[0].save("gray.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun steal-server() | |
(interactive) | |
(shell-command "emacsclient -e '(set-frame-name \"STOLEN\")'") | |
(server-force-delete) | |
(server-start) | |
(set-frame-name "SERVER") | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PAR_CALLOC(T, N) ((T*) calloc(N * sizeof(T), 1)) | |
#define PAR_REALLOC(T, BUF, N) ((T*) realloc(BUF, sizeof(T) * N)) | |
#define PAR_FREE(BUF) free(BUF) | |
typedef struct { | |
uint16_t* values; | |
size_t count; | |
size_t capacity; | |
} par__uint16list; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd tests | |
cat > wombat.fbs <<EOF | |
namespace Fauna; | |
struct Foo { x:short; } | |
table Wombat { foos:[Foo]; } | |
EOF | |
../flatc -p wombat.fbs | |
cat > wombat.py <<EOF | |
import flatbuffers, binascii | |
from Fauna import Wombat, Foo |
OlderNewer