Skip to content

Instantly share code, notes, and snippets.

View ferronrsmith's full-sized avatar
⛱️
Chilling on the beach

Ferron H ferronrsmith

⛱️
Chilling on the beach
View GitHub Profile
package net.shadowraze.vote4diamondz;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@ferronrsmith
ferronrsmith / split.java
Created July 21, 2014 18:58
Delimited Split
private String split(String pInputString, String pDelim, int pMaxLength) {
int len = pInputString.length();
int times = len / pMaxLength;
boolean remainder = len % pMaxLength != 0;
int startIdx = 0;
int endIdx = pMaxLength;
StringBuilder res = new StringBuilder();
if (len <= pMaxLength) {
return pInputString;
} else {

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ferronrsmith
ferronrsmith / mongo_clean_quiet.sh
Last active August 29, 2015 14:04
Cleans mongo db quietly
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})' --port=27015 test
@ferronrsmith
ferronrsmith / mongo_clean.sh
Created August 5, 2014 21:06
clean mongo db
mongo --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})' --port=27015 test
@ferronrsmith
ferronrsmith / querystring.js
Created August 8, 2014 22:18
query string to map
// execute on ready state
jQuery.extend({
getQueryParameters : function (str) {
return (str || document.location.search).replace(/(^\?)/, '').split("&").map(function (n) {
return n = n.split("="), this[n[0]] = n[1], this
}.bind({}))[0];
}
});
@ferronrsmith
ferronrsmith / prettyPrintObj.js
Created September 17, 2014 01:37
node-logging prettyPrintObj.js
// https://github.com/Monwara/node-logging/blob/master/logging.js
function prettyPrintObj(o, excludes) {
excludes = typeof excludes === 'undefined' ? EXCLUDES : excludes;
if (!o || typeof o !== 'object' || !Object.keys(o).length) {
return '*'.grey + ' ' + 'n/a'.green + '\n';
}
var rows = [];