Skip to content

Instantly share code, notes, and snippets.

View johnmurch's full-sized avatar

John Murch johnmurch

View GitHub Profile
@johnmurch
johnmurch / how-to-add-colors-os-x-terminal
Last active August 29, 2015 14:25
OS X Colors Terminal
vim ~/.bash_profile
and paste the following in there:
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
@johnmurch
johnmurch / Hello.txt
Created July 21, 2015 13:13
Email - Trial User
Hi,
I’m John, founder of $company. I saw you signed up for a trial… Can you tell me what would make this a successful trial for you?
Thanks,
John
@johnmurch
johnmurch / results.csv
Last active May 6, 2022 23:47
Scraper for Seeking Alpha
Author URL Count Keywords
Prudent Finances http://seekingalpha.com//author/prudent-finances 1 ex
Dividend Dreams http://seekingalpha.com//author/dividend-dreams 1 ex
Ranjit Goswami http://seekingalpha.com//author/ranjit-goswami 1 ex
WisdomTree http://seekingalpha.com//author/wisdomtree 3 hedge fund,former,ex
George Fisher http://seekingalpha.com//author/george-fisher 1 ex
Edward Harrison http://seekingalpha.com//author/edward-harrison 1 ex
Chris Lau http://seekingalpha.com//author/chris-lau 1 ex
Matthew Bradbard http://seekingalpha.com//author/matthew-bradbard 1 ex
Andy Singh http://seekingalpha.com//author/andy-singh 1 ex
@johnmurch
johnmurch / README.md
Last active September 10, 2015 20:17
Extract JS Object from Form
@johnmurch
johnmurch / diff.js
Created October 6, 2015 03:25
Epoch Diff
var client = 1444099876.816*1000;
var server = 1444099883.941*1000;
var seconds = (new Date(server).getTime() - new Date(client).getTime())/1000;
console.log("SECONDS: "+ seconds)
@johnmurch
johnmurch / session.js
Created February 23, 2016 16:27
Generate SessionId
var crypto = require('crypto');
var generate_key = function() {
var sha = crypto.createHash('sha256');
sha.update(Math.random().toString());
return sha.digest('hex');
};
@johnmurch
johnmurch / screenshot_folder.sh
Created June 30, 2016 20:54
Create Screenshot folder and update default path on OS X - Be sure to change out your username!
#!/bin/bash
mkdir Screenshots
defaults write com.apple.screencapture location /Users/johnmurch/Screenshots
killall SystemUIServer
@johnmurch
johnmurch / hourly.js
Last active July 21, 2016 19:51
Script for running something every hour on the hour no matter when it starts
var now = new Date();
var delay = 60 * 60 * 1000; // 1 hour in msec
console.log('now',new Date().toISOString());console.log('delay',delay,'min',(60 -now.getMinutes()),'sec',(60-now.getSeconds()),'mill',(1000-now.getMilliseconds()));
var start = delay - (now.getMinutes() * 60 + now.getSeconds()) * 1000; //msec until next hour
console.log('start',start);
var kickoff = new Date();
kickoff.setMilliseconds(start);
console.log('kickoff', new Date(kickoff).toISOString());
@johnmurch
johnmurch / uptime.sh
Created July 27, 2016 14:15
Bash Uptime
#!/bin/bash
# uptime.sh
# get uptime from /proc/uptime
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
seconds=$(( uptime%60 ))
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))
@johnmurch
johnmurch / timestamp.sh
Created August 10, 2016 13:43
Timestamp output options
#! /bin/bash
# An overly obvious reference for most commonly requested bash timestamps
# Now all you Mac fags can stop pestering me.
cat << EOD
Format/result | Command | Output
------------------------------+----------------------------+------------------------------
YY-MM-DD_hh:mm:ss | date +%F_%T | $(date +%F_%T)
YYMMDD_hhmmss | date +%Y%m%d_%H%M%S | $(date +%Y%m%d_%H%M%S)