Skip to content

Instantly share code, notes, and snippets.

View thebyrd's full-sized avatar
🌴

David Byrd thebyrd

🌴
View GitHub Profile
@thebyrd
thebyrd / neg.onnx
Created May 4, 2020 22:49
Negate ONNX Model and PyTorch script for generating it.
pytorch1.5:b

01Neg_0"Negtorch-jit-exportZ
0




�b
1

#Cookbook

Redis

If you don’t want to spend time setting up redis yourself, just use thebyrd/redis@2.8.6

$ bowery add cache
$ bowery connect
$ bowery ssh cache
root@17e65aa587e8:/# apt-get install -y gcc
root@17e65aa587e8:/# wget http://download.redis.io/releases/redis-2.8.6.tar.gz
@thebyrd
thebyrd / print.js
Created February 24, 2014 21:24
Print like a boss
function print (m, n) { util.print(m+(!n?"\n":"")); return print; }
function help () {
print
("")
("Node Supervisor is used to restart programs when they crash.")
("It can also be used to restart programs when a *.js file changes.")
("")
("Usage:")
(" supervisor [options] <program>")
@thebyrd
thebyrd / sqrt.go
Last active January 4, 2016 02:08
As a simple way to play with functions and loops, implement the square root function using Newton's method. In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating: To begin with, just repeat that calculation 10 times and see how close you get to the answer for various values (1, 2, 3, ...). Next,…
package main
import (
"fmt"
"math"
)
const Delta = 0.0001
func Sqrt(x float64) float64 {
@thebyrd
thebyrd / stopAndRemove
Created December 30, 2013 17:53
stop and remove all docker containers on a box
docker ps -a | grep 'ago' | awk '{print $1}' | xargs docker rm
@thebyrd
thebyrd / emptyString.js
Created October 28, 2013 17:18
return a string of whitespace of a given length
function emptyString(n) { return new Array(n).join(" ") }
@thebyrd
thebyrd / example.js
Last active December 25, 2015 05:19
A method that will inject npm modules listed as parameters in a constructor.
function SomeConstructor (request, npm, monk) {
// do something with the injected node modules
}
var instance = require('./injector')(SomeConstructor) // create a new instance with dependencies injected
@thebyrd
thebyrd / fatify.js
Created August 21, 2013 03:34
Make all of your tweets look like @fat's
function fatify (str) {
return str.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"").toLowerCase()
}
var list = [1, 3, 5, 5, 23, 23, 4, 3, 3, 6, 7, 4, 2, 2, 5]
var groups = {}
list.forEach(function (n) {
if (groups[n]) groups[n].push(n)
else groups[n] = [n]
})
var result = []
for (var group in groups) result.push(groups[group])
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}