Skip to content

Instantly share code, notes, and snippets.

@jeremyblow
jeremyblow / dreem_csv_to_oscar_zeo.py
Last active February 28, 2024 02:56
Convert Dreem CSV to OSCAR-friendly Zeo CSV
"""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 July 17, 2018 08:23
Fun things for Dabeaz's superbad superboard
"""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 June 16, 2018 01:08
ATmega328p 20kHz PWM for control of Delta THB1748BG
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 April 9, 2016 02:10
Here are some things you can do with Gists in GistBox.
// 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 December 25, 2015 23:59
Mavis Bacon.. mmm.. bacon.
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 December 22, 2015 14:08
Polls Natural Selection 2 API for game status, allows bidirectional chat, and server commands.
Project now resides as GitHub repo here: https://github.com/jeremyblow/NS2
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