Skip to content

Instantly share code, notes, and snippets.

View dydx's full-sized avatar
🎯
Focusing

Josh Sandlin dydx

🎯
Focusing
View GitHub Profile
#include <avr/power.h>
#include <avr/sleep.h>
#include <SHT1x.h>
// i2c for SHT1x
#define dataPin 4
#define clockPin 5
boolean initial = true;
@dydx
dydx / mongod-down
Created December 2, 2014 22:56
management scripts for MongoDB on ChromeOS
#!/bin/bash
echo "Terminating mongodb..."
kill $(pgrep mongod)
@dydx
dydx / parse_all_links.js
Last active December 11, 2020 00:33
A really terrible reply to a question on /r/node
@dydx
dydx / xor_cipher.js
Created January 6, 2015 03:35
fuckin with some xor stuff in javascript
function cipher(message, key) {
return message.split('')
.map(function(element) {
return (element.charCodeAt(0) ^ key);
})
.map(function(element) {
return String.fromCharCode(element)
})
.join('');
}
@dydx
dydx / httpserver.io
Created January 12, 2015 06:26
http server with something resembling a templating language for 'dynamic' content
Iota := Object clone do (
stack := nil
output := nil
init := method (
stack = List clone
output = List clone
)
squareBrackets := method (
@dydx
dydx / shittydb.py
Created January 23, 2015 07:00
#wow so fast
import subprocess
def set(key, val):
f = open(key, 'w')
f.write(val)
f.close()
def get(key):
return subprocess.check_output(["cat", key])
@dydx
dydx / dumb_bloom.js
Last active August 29, 2015 14:15
dumb bloom filter based on a single hash function that adds up the ASCII of a given key string.
module.exports = {
bitArray: Array.apply(null, new Array(100)).map(Number.prototype.valueOf, 0),
hash: function(key) {
return key.split('')
.map(function(element) {
return element.charCodeAt(0);
})
.reduce(function(a, b) {
return a + b;
});

Keybase proof

I hereby claim:

  • I am dydx on github.
  • I am jpsandlin (https://keybase.io/jpsandlin) on keybase.
  • I have a public key whose fingerprint is FDE4 98CC 0023 D84D 4FB0 4A57 2409 F26A BD50 5DEF

To claim this, I am signing this object:

// so this is a thing that was successfully used to "fix" a headers race condition in an Express app.
// Jesus christ this is stupid
function(req, res, next) {
var originalSend = res.send
res.send = function() {
if (this.headersSent()) return
originalSend.apply(this, arguments)
}
}
@dydx
dydx / styles.css
Created March 16, 2015 23:52
Pricing Tables
/*
Theme Name: Parallax Pro Theme
Theme URI: http://my.studiopress.com/themes/parallax/
Description: A mobile responsive and HTML5 theme built for the Genesis Framework.
Author: StudioPress
Author URI: http://www.studiopress.com/
Version: 1.2.1
Tags: black, white, blue, green, orange, pink, one-column, two-columns, responsive-layout, custom-header, custom-menu, full-width-template, sticky-post, theme-options, threaded-comments, translation-ready, premise-landing-page