Skip to content

Instantly share code, notes, and snippets.

View cpdean's full-sized avatar

Conrad cpdean

View GitHub Profile
@cpdean
cpdean / flashing.md
Created December 2, 2017 03:00
preonic flash output
    *** QMK Toolbox (http://qmk.fm/toolbox)
        Supporting following bootloaders:
         - DFU (Atmel, LUFA) via dfu-programmer (http://dfu-programmer.github.io/)
         - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)
         - Halfkay (Teensy, Ergodox EZ) via teensy_loader_cli (https://pjrc.com/teensy/loader_cli.html)
         - STM32 (ARM) via dfu-util (http://dfu-util.sourceforge.net/)
         - Kiibohd (ARM) via dfu-util (http://dfu-util.sourceforge.net/)
    *** DFU device connected
    *** Attempting to flash, please don't remove device
@cpdean
cpdean / map_reduce.js
Created January 27, 2014 23:36
q.js demo for merging the results of an arbitrary number of promises generated by an initial promise.
// @cpdean
// demonstrates how to have one promise kick off
// an additional arbitrary number of promises, and
// then merge their results down again after
// all the promises are complete.
var Q = require('q'); // "q": "~1.0.0"
// initial query that generates seed data for more work to be done
function fakeQuery(){
@cpdean
cpdean / types.ml
Last active January 14, 2017 23:23
(* how is this: *)
type value = [
| `Assoc of (string * value) list
| `Bool of bool
| `Float of float
| `Int of int
| `List of value list
| `Null
| `String of string
]
@cpdean
cpdean / ergodox.ascii.txt
Last active August 31, 2016 21:20
Stealing this from a forum. want to keep better track of ergodox layout outside of massdrop's tool
/* LAYER 0
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | + = | | +L2 | 6 | 7 & | 8 * | 9 ( | 0 ) | -_ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | \ | | | { | Y | U | I | O | P | } ] |
* |--------+------+------+------+------+------| \ | | | [ |------+------+------+------+------+--------|
* | LCtrl | A | S | D | F | G |------| |------| H | J | K | L | ; : | ' " |
* |--------+------+------+------+------+------| ~L1 | | ~L1 |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | ,< | . > | / ? | RShift |
@cpdean
cpdean / README.md
Last active February 28, 2016 18:22
dynamic network
@cpdean
cpdean / README.markdown
Last active December 31, 2015 02:39
put CSS files next to this and find redundant rules. maybe you can use that to guide yourself in an OOCSS refactor

With the power of bash piping and a tiny python script you can see what css rules could stand to be merged into simple classes.

@cpdean
cpdean / SomeBolt.scala
Created December 3, 2013 03:03
Getting keywords out of a search
import com.example.util.Codec
import com.example.storm.bolts.IntervalBolt
import com.github.theon.uri.Uri.parseUri
class SomeBolt (serializer:Serializer, ticksBeforeFlush: Int, bufferLimit: Int)
extends IntervalBolt(ticksBeforeFlush) with Codec{
def bufferOffInterval(input: Tuple) = ???
def onInterval() = ???
@cpdean
cpdean / find_daily_performance_increase.js
Last active December 23, 2015 16:29
for an stream of pings, use the mongodb aggregation pipeline to find which urls do better in the morning than in the evening
// The following is a function defined in the mongo shell
// use transfer # switch to the transfer db
// t = transfer.test # save the important collection off to this temp
// unfortunately this is stuck to only work on july 28, 2013
function show_daily_improvers(){
return t.aggregate(
{$match:{time:{$gte:ISODate("2013-07-28"),
$lt:ISODate("2013-07-29")}}
},
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
@cpdean
cpdean / quicktest.py
Last active December 21, 2015 05:39
modelled after haskell's textbook quicksort
def quicksort(bros):
if len(bros) == 0:
return []
else:
first = bros[0]
rest = bros[1:]
smallerbros = quicksort([i for i in rest if i < first])
biggerbros = quicksort([i for i in rest if i >= first])
return smallerbros + [first] + biggerbros