Skip to content

Instantly share code, notes, and snippets.

View fakedrake's full-sized avatar

Chris Perivolaropoulos fakedrake

View GitHub Profile
_ct_code = 00000000;
errno = 00000000;
_Z13ff_kernel_cosdd = 00001270;
_Z13ff_kernel_sinddi = 00001690;
_Z14ff_kernel_cosfff = 00001168;
_Z6ff_logd = 00004590;
_Z6ff_powdd = 00005688;
_Z7ff_cosff = 00001960;
_Z7ff_logff = 00004308;
_ct_B = 00000007;
_ct_C = 00000005;
_ct_D = 00000002;
_ct_L = 00000000;
_ct_P = 00000004;
_ct_S = 00000006;
_ct_U = 00000001;
_ct_X = 00000003;
_ct_code = 00000000;
__adddf3 = 0x872c;
__bss_start = 0xa534;
__divdf3 = 0x9348;
__eqdf2 = 0x9054;
__fixdfsi = 0x9964;
__floatsidf = 0x9a00;
__gedf2 = 0x8f38;
__got_end = 0xa534;
__got_start = 0xa534;
__gtdf2 = 0x927c;
import math
def trueclass(line):
return line[-1] == "NAI"
def log2(x):
if x != 0:
return math.log(x,2)
return 0
class SqlPresenterMixin(object):
""" Provide the sql query to the context.
"""
def get_context_data(self, **kwargs):
context = super(SqlPresenterMixin, self).get_context_data(**kwargs)
context['sqlquery'] = str(self.get_queryset().query)
return context
(defadvice save-buffer (around save-buffer-as-root-around activate)
"Use sudo to save the current buffer."
(interactive "p")
(if (and (buffer-file-name) (not (file-writable-p (buffer-file-name))))
(let ((buffer-file-name (format "/sudo::%s" buffer-file-name)))
ad-do-it)
ad-do-it))
@fakedrake
fakedrake / spectrogram.py
Created August 17, 2013 16:36
Create a spectrogram of a 2channel 2byte per sample wav file
#!/usr/bin/env python
import os
import wave
import numpy as np
from PIL import Image
def graph_channel(ch, sw):
wch_tmp = [iter(ch)]*sw
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
#!/usr/bin/python
import struct
# Each channel is 8bit before conversion
class Counter:
def __init__(self, max, len):
self.clen = 0
self.maxlen = len
#!/usr/bin/env python
import os
import wave
import numpy as np
from PIL import Image
def graph_channel(ch, sw):