Skip to content

Instantly share code, notes, and snippets.

@oseiskar
oseiskar / scheduler.py
Created July 18, 2014 12:26
Festival schedule generation script
#!/usr/bin/python
#
# A script for generating a printable HTML festival schedule from CSV input.
#
# Usage: ./this-file.py < schedule.txt > schedule.html
# see the readSchedule function for input format description
#
import sys
def toFloatMinutes(s):
ACTIVE_RECORD_VERSION =
'master' # fails
# '4.2.2' # fails
# '4.1.11' # fails
# '4.0.13' # passes
if ACTIVE_RECORD_VERSION == 'master'
require 'bundler/inline'
@oseiskar
oseiskar / fwrite.c
Created October 1, 2015 08:08
R fast CSV writing proof of concept
#include <R.h>
#include <errno.h>
#include <Rinternals.h>
void write_csv_fast(SEXP list_of_columns, SEXP filename) {
SEXP *columns = NULL;
int error_number = 0;
const char COL_SEP = ',';
@oseiskar
oseiskar / find-non-ascii.py
Created October 7, 2015 16:09
Finds and highlights non-ASCII characters in STDIN, line-by-line
#!/usr/bin/python
"Finds and highlights non-ASCII characters in STDIN (python 2)"
import sys
def is_ascii(str):
try:
str.encode('ascii')
return True
except: return False
@oseiskar
oseiskar / bootstrap.m
Last active November 15, 2015 09:53
Parametric bootstrap experiment
%% GNU Octave
% The model
function y = model(x, y0, theta, sigma)
noise = randn(size(x))*sigma;
y = y0 * exp(-theta*x) + noise;
endfunction
% Least squares-type fit to the model
function [y0, theta, sigma] = fit_model(x, y)
%% GNU Octave
% Computes a maximum a posteriori (MAP) estimate X for the hidden states
% for the given DNA sequence Q under the pre-defined hidden Markov model
% Depending on what the mode parameter is, this computes
%
% 'any-sequence' (default)
%
% X = (x_1, ..., x_n) \in argmax_{x_1, ..., x_n} P(Q|x_1,...,x_n)
%
@oseiskar
oseiskar / tupasform.html
Created June 5, 2015 14:31
TUPAS test form
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha256.js"></script>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
<title>TUPAS test</title>
</head>
@oseiskar
oseiskar / jupyter-scala-breeze-viz-poc.ipynb
Created September 25, 2016 18:14
Proof of Concept: jupyter-scala with embedded images from breeze-viz
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oseiskar
oseiskar / rc_discharge.ipynb
Created June 16, 2018 14:05
RC discharge simulation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oseiskar
oseiskar / sine_wave_reconstruction.ipynb
Created August 18, 2018 20:40
Amplitude and phase reconstruction simulation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.