Skip to content

Instantly share code, notes, and snippets.

@jeremyblow
jeremyblow / dreem_csv_to_oscar_zeo.py
Last active Sep 27, 2020
Convert Dreem CSV to OSCAR-friendly Zeo CSV
View dreem_csv_to_oscar_zeo.py
"""Convert Dreem CSV to OSCAR-friendly Zeo CSV
Liberty taken with the ZQ column, pinning it to 0. Other non-common fields are nulled.
Tested with Python 3.7.3 and 2.7.10.
Usage:
python dreem_csv_to_oscar_zeo.py data_in.csv data_out.csv
"""
from csv import DictReader, DictWriter
from datetime import datetime, timedelta
@jeremyblow
jeremyblow / superboard.py
Created Jul 17, 2018
Fun things for Dabeaz's superbad superboard
View superboard.py
"""Fun things for Dabeaz's superbad superboard.
Default Audio Format:
Frame rate: 48kHz
Channels: 1
Bytes per sample: 1
Superboard Encoding:
Baud rate: 300
@jeremyblow
jeremyblow / main.c
Last active Jun 16, 2018
ATmega328p 20kHz PWM for control of Delta THB1748BG
View main.c
void setup() {
// Core clock runs at 16MHz, three different timers can divide this freq
// by using a prescalar factor. Different PWM modes are available for each
// timer. We are using Fast PWM, which has the counter count from 0 to TOP.
// Thus, timer frequency would be 16MHz / prescalar / TOP count. The output
// turns on when the timer is at 0, and turns off when reaches the compare
// register value. As the compare register approaches TOP, the duty cycle
// approaches 100%. Since 0 is included in the high state, the effective
// counts in the high state will be the register value + 1.
//
@jeremyblow
jeremyblow / 0_reuse_code.js
Created Apr 9, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jeremyblow
jeremyblow / gist:7060658
Last active Dec 25, 2015
Mavis Bacon.. mmm.. bacon.
View gist:7060658
import urllib2
import random
import difflib
import datetime
def fetch(url):
"""Fetches requested url, returns lines in list"""
response = urllib2.urlopen(url)
lines = response.readlines()
return lines
@jeremyblow
jeremyblow / natsel2_poll.py
Last active Dec 22, 2015
Polls Natural Selection 2 API for game status, allows bidirectional chat, and server commands.
View natsel2_poll.py
Project now resides as GitHub repo here: https://github.com/jeremyblow/NS2
View gist:5733394
Sources:
- http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
- http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=22975
- http://www.thomaskho.com/blog/2006/02/qemu-and-the-network-bridge/
- http://toast.djw.org.uk/qemu.html
- http://wiki.debian.org/QEMU#Host_and_guests_on_same_network
Files needed:
- http://downloads.raspberrypi.org/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip.torrent
- http://xecdesign.com/downloads/linux-qemu/kernel-qemu