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
@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 / CSVToArray.js
Created September 17, 2014 01:24
CSVToArray converter
// This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
function CSVToArray( strData, strDelimiter ){
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter || ",");
// Create a regular expression to parse the CSV values.
var objPattern = new RegExp(
@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 = [];
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
sudo dpkg -i elasticsearch-1.1.1.deb
@ferronrsmith
ferronrsmith / striptags.js
Created October 7, 2014 04:52
strip html tags in js
var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");
@ferronrsmith
ferronrsmith / tmux.md
Last active August 29, 2015 14:07 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ferronrsmith
ferronrsmith / finch.md
Created October 9, 2014 07:51
finch shorcuts

Abbreviations

M- means hold the META or EDIT or ALT key down while typing . If there is no META, EDIT or ALT key, instead press and release the ESC key and then type in quick succession.

How do I switch between windows?

You can press M-n/M-p to go to the next/previous window, or M-N where N is 1-9. You can also press M-w to bring out a list of all the windows. In the window list, you can select a row and press return to go to that window.

How can I close a window?

#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd