This file contains hidden or 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
# 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 |
This file contains hidden or 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/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. |
This file contains hidden or 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
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, |
This file contains hidden or 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/env python | |
__all__ = ["monotonic_time"] | |
import ctypes, os | |
CLOCK_MONOTONIC_RAW = 4 # see <linux/time.h> | |
class timespec(ctypes.Structure): | |
_fields_ = [ |
This file contains hidden or 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
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; |