Skip to content

Instantly share code, notes, and snippets.

View ssube's full-sized avatar

Sean Sube ssube

View GitHub Profile
@ssube
ssube / .tmux.conf
Last active November 16, 2017 08:31
tmux with vim bindings for atom terminal-plus with tmux bindings
# use UTF8
set -g utf8
set-window-option -g utf8 on
# make tmux display things in 256 colors
#set -g default-terminal "xterm-256color"
# set scrollback history to 10000 (10k)
set -g history-limit 10000
node "craft-1.yoursite.net" {
$craft_pkgs = ['java-1.8.0-openjdk', 'java-1.8.0-openjdk-devel']
$craft_root = '/opt/craft'
$craft_user = 'craft'
$craft_jar = "${craft_root}/minecraft.jar"
$craft_props = '
allow-flight=true
allow-nether=true
difficulty=2
@ssube
ssube / help.js
Last active March 1, 2016 19:07 — forked from Technoash/help.js
validateRegister(req.body).then(function(){
return db.createUser(req.body.name, req.body.email, req.body.password);
}).then(function(newUser){
console.log(2);
res.send({state: 'success', name: newUser.name});
}).catch(function(err){
res.send(500);
});
@ssube
ssube / alpg-quicksort.js
Last active February 16, 2016 20:01
Quicksort for ALPG (http://awal.js.org/alpg/)
function getRandomIntInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function swap(items, firstIndex, secondIndex, transact){
var temp = items[firstIndex];
items[firstIndex] = items[secondIndex];
items[secondIndex] = temp;
initialState.swapLeft = firstIndex;
@ssube
ssube / di.js
Last active February 8, 2016 18:21
simple JS dependency injection
// Example interface and implementation
class Filesystem {
read(filename) {
throw new Error('Not implemented!');
}
write(filename, content) {
throw new Error('Not implemented!');
}
}
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
function withinRadius(v, r) {
return v.l < r;
}
function getDistance(playerA, playerB) {
const x = playerA.position.x - playerB.position.x;
const y = playerA.position.y - playerB.position.y;
const l = Math.sqrt((x * x) + (y * y));
return {x, y, l};
}
String
= t:Token* { return t; }
Token
= v:Var { return v; }
/ v:Part { return v; }
Var
= T_START T_OPEN n:Name T_CLOSE { return {type: "var", name: n}; }
export default class Color {
/**
* Default constructor, taking each component as an argument: new Color(128, 0, 255)
* The opacity (alpha, a) is optional and defaults to 1.0 (100%).
*/
constructor(r, g, b, a = 1.0) {
this._r = r;
this._g = g;
this._b = b;
this._a = a;
@ssube
ssube / setup.sh
Created October 21, 2015 15:30
server setup
#! /bin/bash
yum install -y epel-release
yum install -y git