This file contains 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
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#include <avr/wdt.h> | |
#include <avr/sleep.h> | |
#include <util/delay.h> | |
// cribbing from http://electronics.stackexchange.com/a/74850 | |
void prevent_wdt_reset() { | |
if(MCUSR & _BV(WDRF)){ // If a reset was caused by the Watchdog Timer... |
This file contains 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
import h5py as h5 | |
import numpy as np | |
from scipy.io import savemat | |
def save_class_scores(path, bin_id, scores, roi_numbers, class_labels): | |
assert scores.shape[0] == len(roi_numbers), 'wrong number of ROI numbers' | |
assert scores.shape[1] == len(class_labels), 'wrong number of class labels' | |
with h5.File(path,'w') as f: | |
ds = f.create_dataset('scores', data=scores, compression='gzip', dtype='f4') |
This file contains 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 wide_to_long(df, wide_cols_list, value_cols, long_col, long_labels): | |
"""converts selected columns from wide to long format. params: | |
- df: the input dataframe | |
- wide_cols_list: for each set of wide columns, a list of their names | |
- value_cols: for each set of wide columns, the name of the long column to hold the values | |
- long_col: the name of the column to indicate which set of wide columns the value comes from | |
- long_labels: for each set of wide columns, what to call it in the long_col values. | |
For example if I have the following DataFrame: |
This file contains 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
# current as of 2018-12-10 | |
# install docker-ce: https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1 | |
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) \ | |
stable" | |
sudo apt-get update |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
import os | |
from scipy.io import loadmat | |
import pandas as pd | |
from pocean.dsg.timeseriesProfile.om import OrthogonalMultidimensionalTimeseriesProfile as OMTP | |
MAT_FILE = '/vagrant/nut_data_reps.mat' | |
OUT_DIR = './output' | |
mat = loadmat(MAT_FILE, squeeze_me=True) |
This file contains 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
<dataset type="EDDTableFromNcCFFiles" datasetID="lter-nutrient" active="true"> | |
<reloadEveryNMinutes>10080</reloadEveryNMinutes> | |
<updateEveryNMillis>10000</updateEveryNMillis> | |
<fileDir>/home/vagrant/lter-poc/output/</fileDir> | |
<fileNameRegex>.*\.nc</fileNameRegex> | |
<recursive>true</recursive> | |
<pathRegex>.*</pathRegex> | |
<metadataFrom>last</metadataFrom> | |
<preExtractRegex></preExtractRegex> | |
<postExtractRegex></postExtractRegex> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/bin/sed -e | |
1i digraph foo { | |
s/\([[:alnum:]]*\) \([[:alnum:]]*\) \([[:alnum:]]*\)/\1 -> \3 [label="\2"];/ | |
$a } |
This file contains 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
( | |
Routine({ | |
SynthDef("buzz", {arg bufnum; | |
var dust, pitch, density, amp, env, pan, osc, gate; | |
var brown1, brown2, brown3, brown4, brown5; | |
var pitch1, pitch2; | |
pitch1 = IRand(10,128); | |
pitch2 = IRand(10,128); | |
brown1 = LFNoise2.kr(LFNoise2.kr(0.1, 10).abs + 0.1, LFNoise2.kr(0.1, 1.0).abs).abs; | |
brown2 = LFNoise2.kr(LFNoise2.kr(0.1, 10).abs + 0.1, LFNoise2.kr(0.1, 1.0).abs).abs; |