Skip to content

Instantly share code, notes, and snippets.

@yangle
yangle / basic.py
Created November 11, 2011 23:00
matplotlib
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import datetime
infodict={'Author':'yAngle',
'CreationDate':datetime.datetime.today(),
'ModDate':datetime.datetime.today(),
}
fig=plt.figure(figsize=(3.4,2.2)) # 3.4 for RevTeX columnwidth, 2.2 ~ golden ratio
@yangle
yangle / mylib.c
Created November 11, 2011 23:02
ctypes examples
// gcc -std=c99 -O3 -fPIC -shared -Wl,-soname,mylib -o mylib.so mylib.c
#include <stdio.h>
#include <complex.h>
int build_hamiltonian(int i, double d, complex double *m)
{
m[0]=2.*I;
return 0;
}
@yangle
yangle / bomb.py
Created November 12, 2011 08:17
python debugging
import traceback, sys, code
def bombs():
a = []
print a[0]
if __name__ == '__main__':
try:
bombs()
except:
@yangle
yangle / PKGBUILD
Created March 17, 2012 18:54
Arch Linux AUR Package for Pithos with Socks Proxy Patch
# Contributor: Matthew Bauer <mjbauer95@gmail.com>
# Maintainer: Steven Allen <steven@stebalien.com>
_pkgname='pithos'
pkgname="$_pkgname-git"
pkgver=20120829
pkgrel=1
pkgdesc='A Pandora Radio (pandora.com) player for the GNOME Desktop using the libpiano library (also used by pianobar).'
arch=('any')
url="https://github.com/yAngle/$_pkgname"
@yangle
yangle / downgrade.py
Created April 5, 2012 06:25
undo pacman upgrade
#!/usr/bin/env python2
import re
import os
import errno
def mkdir(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
@yangle
yangle / PKGBUILD
Last active April 7, 2020 19:17
zathura PKGBUILD, with clipboard fix.
# $Id: PKGBUILD 82563 2013-01-21 00:12:49Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: ML <neldoreth>
pkgname=zathura
pkgver=0.2.2
pkgrel=1
pkgdesc="a document viewer"
arch=('i686' 'x86_64')