Skip to content

Instantly share code, notes, and snippets.

View ebarcikowski's full-sized avatar

Elliott Barcikowski ebarcikowski

  • Salt Lake City, UT
View GitHub Profile
# either put in startup file or at start of ob-ipython based org
# document.
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sb
import numpy as np
import pandas as pd
import math
from scipy.stats import norm
import matplotlib as mpl
@ebarcikowski
ebarcikowski / h2py.py
Last active May 16, 2017 15:53
c header to python
#! /usr/bin/env python
# Cool script, stolen from:
# https://hg.python.org/cpython/log/70274d53c1dd/Tools/scripts/h2py.py
# Read #define's and translate to Python code.
# Handle #include statements.
# Handle #define macros with one argument.
# Anything that isn't recognized or doesn't translate into valid
# Python is ignored.
@ebarcikowski
ebarcikowski / irq_prio.py
Created April 28, 2017 20:56
set RT interupt priorities
def set_system_rt_priorities():
prio_table = {
'irq/8-rtc0': 90,
'ktimersoftd/0': 85,
'ktimersoftd/1': 85,
'ktimersoftd/2': 85,
'ktimersoftd/3': 85,
'irq/88-eth0': 85,
'irq/89-eth0-TxR': 85,
'irq/90-eth0-TxR': 85,
#!/usr/bin/env python
__all__ = ["monotonic_time"]
import ctypes, os
CLOCK_MONOTONIC_RAW = 4 # see <linux/time.h>
class timespec(ctypes.Structure):
_fields_ = [
@ebarcikowski
ebarcikowski / rand.cpp
Last active February 7, 2017 06:15
Basic formula for generating simple random distributions
double gaussian(double mu, double sigma)
{
//TODO: This is not thread safe!
static double lastRandValue = RAND_MAX;
if (lastRandValue != RAND_MAX) {
double rt = mu + sigma*lastRandValue;
lastRandValue = RAND_MAX;
return rt;
}
double s = 0;