Skip to content

Instantly share code, notes, and snippets.

testp
x
@tusing
tusing / CHECKED_COMMENTS.txt
Last active July 28, 2016 22:45
FanfictionBot Comment Backup:
d5am68b
d48mjja
d459cpq
d4qd9w8
d4pb6u9
d4arlnf
d5e76ux
d4p17cl
d4ouwg8
d44ot8g
#!/usr/bin/env python
# Display a list of user-defined color bars;
# fill the remaining area with sparkles.
# Designed for the Unicorn pHAT.
# By tusing.
import unicornhat as unicorn
from random import randint
#######################################################
#### NOW AT A GITHUB REPO ####
#### https://github.com/tusing/unicorn_phat ####
#######################################################
#!/usr/bin/env python
# Display a list of user-defined color bars;
# fill the remaining area with sparkles.
# Designed for the Unicorn pHAT.
@tusing
tusing / plot.py
Created December 2, 2016 06:57
plotting stuff for project-nanotech
import glob
import csv
import re
import collections
import ast
import numpy as np
from collections import defaultdict
import plotly.plotly as py
import plotly.graph_objs as go
@tusing
tusing / barebones.py
Created December 10, 2016 00:54
project stuff
import freenect
import cv2
import numpy as np
import sys, getopt
import math
import RPi.GPIO as GPIO
import time
import atexit
def main(argv):
import freenect
import numpy as np
from threading import Thread, RLock
class KinectParser:
def __init__(self, x, y, function=False):
if function is False:
self.function = self.decayingAverage
else:
"""CameraParser - designed to parse data from a camera such as the Microsoft
Kinect, in order to translate the data into intuitively acceptable input,
such as haptic feedback, for blind individuals.
The ideal use case is as such:
1) We have a vest with haptic feedback motors. We have a Kinect, or some
camera capable of giving us meaningful data for blind individuals, e.g.
depth.
2) We parse data from the Kinect into subdivided segments - one
for every motor. For example, a vest with 4 motors would mean
#define RGBLIGHT_CURRENT_PER_STRIP_LIGHT 60
#define RGBLIGHT_NUM_STRIP_LIGHTS 16
#define MAX_STRIP_CURRENT 400
void adjust_current(bool rgbw) {
// Pass in rgbw=True if you have rgbw strips.
float max_rgbw_val = (255 * (3 + rgbw)) * ((MAX_STRIP_CURRENT /
RGBLIGHT_NUM_STRIP_LIGHTS) / RGBLIGHT_CURRENT_PER_STRIP_LIGHT);
for (uint8_t i = 0; i < RGBLED_NUM; i++) {