Skip to content

Instantly share code, notes, and snippets.

View riebschlager's full-sized avatar

Chris Riebschlager riebschlager

View GitHub Profile
let ids = [];
const fs = require('fs');
if(!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength, padString) {
targetLength = targetLength >> 0;
padString = String(padString || ' ');
if(this.length > targetLength) {
return String(this);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from pygame.locals import *
import os
import pygame
import random
import serial
#include <MPR121.h>
#include <Wire.h>
#define numElectrodes 6
void setup()
{
Serial.begin(9600);
while (!Serial);
Wire.begin();
const int sensorPin = 9; // PW socket on sensor board
const int relayPin = 10; //
const int threshold = 48; //
const bool DEBUG = false;
int ticks = 0;
void setup() {
Serial.begin(9600);
// Double-check that these pins are correct.
const int sensorPin = 9;
const int relayPin = 10;
const int threshold = 50;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
pinMode(relayPin, OUTPUT);
function Util() {}
Util.prototype.map = function(input, oldMin, oldMax, newMin, newMax) {
return ((input - oldMin) / (oldMax - oldMin)) * (newMax - newMin) + newMin;
};
Util.prototype.random = function(min, max) {
var rand = Math.random();
if (arguments.length === 0) {
return rand;
var colors = [0x96cb79, 0x94ca7b, 0x92ca7d, 0x90c97e, 0x8ec980, 0x8cc882, 0x8ac884, 0x88c785, 0x86c787, 0x84c689, 0x82c58a, 0x80c58c, 0x7ec48e, 0x7bc48f, 0x79c391, 0x76c393, 0x74c294, 0x71c296, 0x6fc198, 0x6cc099, 0x69c09b, 0x66bf9d, 0x63bf9e, 0x60bea0, 0x5dbea2, 0x5abda3, 0x56bda5, 0x53bca6, 0x4fbca8, 0x4abbaa, 0x46bbab, 0x41baad, 0x3cbaae, 0x36b9b0, 0x43baad, 0x4ebbaa, 0x57bda7, 0x5fbea4, 0x67bfa1, 0x6ec09e, 0x74c19b, 0x7ac398, 0x80c495, 0x86c592, 0x8bc68f, 0x90c78c, 0x95c989, 0x9aca86, 0x9fcb83, 0xa3cc7f, 0xa8cd7c, 0xaccf79, 0xb0d075, 0xb4d172, 0xb8d26e, 0xbcd36b, 0xc0d567, 0xc4d663, 0xc8d75f, 0xccd85b, 0xd0da57, 0xd3db53, 0xd7dc4f, 0xdadd4a, 0xdedf45, 0xe2e040, 0xe5e13a, 0xe5de3a, 0xe4db3a, 0xe4d83a, 0xe3d53a, 0xe3d23a, 0xe2cf3a, 0xe2cd3a, 0xe2ca39, 0xe1c739, 0xe0c439, 0xe0c139, 0xdfbe39, 0xdfbb39, 0xdeb839, 0xdeb539, 0xddb238, 0xddaf38, 0xdcac38, 0xdbaa38, 0xdba738, 0xdaa438, 0xd9a137, 0xd99e37, 0xd89b37, 0xd79837, 0xd69537, 0xd69236, 0xd58f36, 0xd48c36, 0xd38936, 0xd38635, 0xd28335, 0xd18035];
const MO
@riebschlager
riebschlager / bridgeify.py
Created September 13, 2016 14:12
Create Spotify playlists based on the last 24 hours of music played by The Bridge - https://bridge909.org/
import spotipy
import spotipy.util as util
import time
import urllib
import urllib2
import json
from datetime import datetime
from datetime import timedelta
import urllib2
import json
import csv
import time
import math
from datetime import datetime
from datetime import timedelta
epoch = datetime.utcfromtimestamp(0)
Base URL: http://nwhof.org/champions/public/hofRPC.php
Required Post Params
id: Doesn't seem to matter what it is. Just leave it at 1.
method: A method defined in hallOfFameFrontEnd.php
params: An array of params used by the method
Example call: