Skip to content

Instantly share code, notes, and snippets.

View msiemens's full-sized avatar

Markus Siemens msiemens

View GitHub Profile
/^Author:/ {
author = $2
commits[author] += 1
commits["tot"] += 1
}
/^[0-9]/ {
more[author] += $1
less[author] += $2
file[author] += 1
@msiemens
msiemens / detectFlash.js
Created August 8, 2012 16:26
Single Line Flash Detection in Javascript
var hasFlash = navigator.mimeTypes&&navigator.mimeTypes.length?Array.prototype.slice.call(navigator.mimeTypes).some(function(a){return"application/x-shockwave-flash"==a.type}):/MSIE/.test(navigator.userAgent)?eval("try{new ActiveXObject('ShockwaveFlash.ShockwaveFlash')&&!0}catch(e){!1};"):!1;
@msiemens
msiemens / helpers.py
Last active August 29, 2015 14:04
My helpers.py file
"""
My compilation of small helper functions.
"""
import logging
import os
import threading
import traceback
import sys
from logging.handlers import SMTPHandler
@msiemens
msiemens / types.c
Created May 24, 2014 18:01
Fundamental C Types
int main(void) {
char v_char;
unsigned char v_uchar;
short v_short;
unsigned short v_ushort;
int v_int;
unsigned int v_uint;
long v_long;
unsigned long v_ulong;
long long v_longlong;
@msiemens
msiemens / gist:6672efc032769758423b
Last active August 29, 2015 14:01
SymPy Fourier Series
def fourier_series(f, frange, t, t_0):
k = symbols('k', integer=True, positive=True, zero=False)
a_k = 2/t_0*(integrate(f * cos(2*pi/t_0*k*t), [t, frange[0], frange[1]]))
a_k = [a_k.subs(k, i) for i in range(1, 10)]
b_k = 2/t_0*(integrate(f * sin(2*pi/t_0*k*t), [t, -t_0/2, t_0/2]))
b_k = [b_k.subs(k, i) for i in range(1, 10)]
# Amplitude