Skip to content

Instantly share code, notes, and snippets.

Avatar

Ken Koch kkoch986

  • Zentail
  • Raleigh, NC
View GitHub Profile
@kkoch986
kkoch986 / conkyrc.lua
Last active Oct 14, 2018
my WIP dzen / conky status bar
View conkyrc.lua
conky.config = {
out_to_x = false,
out_to_console = true,
update_interval = 1.0,
total_run_times = 0,
use_spacer = none,
use_xft = true,
override_utf8_locale = true,
font = 'Terminus:style = Regular:pixelsize=24:antialias=true'
}
View keybase.md

Keybase proof

I hereby claim:

  • I am kkoch986 on github.
  • I am kkoch986 (https://keybase.io/kkoch986) on keybase.
  • I have a public key ASDdVpZP15gn6CeGR0mdujmCNkbbiPKSKZBuh4XsAzA_pQo

To claim this, I am signing this object:

@kkoch986
kkoch986 / pooltable.py
Last active Jul 6, 2016
working on a cv experiment for the pool table
View pooltable.py
import cv2
import numpy as np
import operator
from numpy import pi, sin, cos
import math
## Tweak these
hue_threshold = [4,3] # the lower and upper threshold for hue values in the mask
median_kernel_size = 5
@kkoch986
kkoch986 / MultiSelect.jsx
Last active Mar 6, 2017
A MultiSelect prototype for Material UI (v.0.14.4)
View MultiSelect.jsx
/**
* Material UI multi select
*
* Use with:
* <MultiSelect fullWidth={true} value={this.state.values} onChange={(e,v) => this.setState({values: v})}>
* <ListItem primaryText={"Option 1"} value={1} />
* <ListItem primaryText={"Option 2"} value={2} />
* <ListItem primaryText={"Option 3"} value={3} />
* <ListItem primaryText={"Option 4"} value={4} />
* </MultiSelect>
@kkoch986
kkoch986 / fooball.ino
Created Apr 9, 2016
Arduino code for my foosball table
View fooball.ino
// Circuit Board Pins
// 1- PhotoCell 1 +5
// 2- Arduino A0
// 3- PhotoCell 1 Ground
// 4- PhotoCell 2 +5
// 5- Arduino A1
// 6- PhotoCell 2 Ground
// 7- Arduino D2
// 8- Buzzer +
// 9- Buzzer -
@kkoch986
kkoch986 / crush.js
Last active Dec 29, 2015 — forked from mbuff24/crush.js
Naive javascript solution for Algorithmic Crush -- https://www.hackerrank.com/contests/w4/challenges/crush
View crush.js
String.prototype.splitSpacesAsInts = function() {
return this.split(" ").map(function(aNum) { return parseInt(aNum); });
};
function processData(input) {
var lines = input.split("\n");
var first = lines[0].splitSpacesAsInts();
var n = first[0];
var m = first[1];
var ops = lines.slice(1).map(function(line) { return line.splitSpacesAsInts(); });
@kkoch986
kkoch986 / prisoners.js
Last active Aug 29, 2015
A simulation of 2 solutions to the prisoners with the light switch problem
View prisoners.js
function solve(prisoner_count, hard_limit) {
var prisoners = [];
var startTime = ((new Date()).getTime());
for(var x = 0 ; x < prisoner_count ; x++) {
prisoners[x] = false;
}
// Pick a random prisoner
function pickPrisoner() {
return Math.floor(Math.random() * prisoner_count);
@kkoch986
kkoch986 / basic-vis.html
Last active Jan 31, 2022
A basic audio visualization using only js
View basic-vis.html
<script type="text/javascript" src='http://code.jquery.com/jquery-2.1.3.min.js'></script>
<audio id="myAudio" src="http://sqr.bartekdrozdz.com/demo/soundviz/assets/spy.mp3" controls><p>Your browser does not support the audio element.</p></audio>
<!-- <audio id="myAudio" src="./a-little-something.mp3" controls><p>Your browser does not support the audio element.</p></audio> -->
<div id="visualization" style="width:100%; height:500px"></div>
<script type="text/javascript">
Number.prototype.map = function ( in_min , in_max , out_min , out_max ) {
return ( this - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min;
}
@kkoch986
kkoch986 / nueralnets.js
Created Dec 2, 2014
playing with neural nets
View nueralnets.js
var Unit = function(value, grad) {
this.value = value;
this.grad = grad;
};
var multiplyGate = function(){ };
multiplyGate.prototype = {
@kkoch986
kkoch986 / extraction.py
Last active Apr 12, 2018
NLTK Sentence extraction
View extraction.py
import nltk, re, pprint
import json
import sys
# a function to convert a tree into an array for json encoding
def tree_to_dict(tree):
return {tree.label(): [tree_to_dict(t) if isinstance(t, nltk.Tree) else t for t in tree]}
# download required corpora
required_downloads = [