Skip to content

Instantly share code, notes, and snippets.

@gsharp
gsharp / hbsms.txt
Last active December 15, 2016 09:07
__ __ _______ __ __ __ __
/ | / | / \ / | / | / | / |
$$ | $$ | ______ ______ ______ __ __ $$$$$$$ |$$/ ______ _$$ |_ $$ |____ ____$$ | ______ __ __
$$ |__$$ | / \ / \ / \ / | / | $$ |__$$ |/ | / \ / $$ | $$ \ / $$ | / \ / | / |
$$ $$ | $$$$$$ |/$$$$$$ |/$$$$$$ |$$ | $$ | $$ $$< $$ |/$$$$$$ |$$$$$$/ $$$$$$$ |/$$$$$$$ | $$$$$$ |$$ | $$ |
$$$$$$$$ | / $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$$$$$$ |$$ |$$ | $$/ $$ | __ $$ | $$ |$$ | $$ | / $$ |$$ | $$ |
$$ | $$ |/$$$$$$$ |$$ |__$$ |$$ |__$$ |$$ \__$$ | $$ |__$$ |$$ |$$ | $$ |/ |$$ | $$ |$$ \__$$ |/$$$$$$$ |$$ \__$$ |
$$ | $$ |$$ $$ |$$ $$/ $$ $$/ $$ $$ | $$ $$/
#setup some basic python script to get params from the command line
import sys
Param1 = sys.argv[0] #make the first param map to variable Param1
Param2 = sys.argv[1] #make the first param map to variable Param2
# now the google example
# from google api https://developers.google.com/drive/web/manage-downloads#examples
from apiclient import errors
# ...
{
init: function(elevators, floors) {
var elevator = elevators[0]; // Let's use the first elevator
function go(num) {
// set a listener for up button pressed
floors[num].on("up_button_pressed", function() {
console.log ("floor button up pressed, going to floor: " + num);
elevator.goToFloor(num);
})
// set a listener for up down button pressed
@gsharp
gsharp / lsvf.sh
Last active August 29, 2015 14:08
ls vowel finder
ls | awk 'm = /[aeiou]/ { print $0 ": has a vowel"} !m { print $0 ": does not have a vowel" }'
@gsharp
gsharp / ttny.sh
Last active August 29, 2015 14:08
time to new year
export epoch=$(($(date -j -f "%d-%B-%y" 01-JAN-15 +%s) - $(date +%s)));
printf "\n\nTime from now to new year! \n\n months: %s\n weeks: %s\n days: %s\n hours: %s\n minutes: %s\n" $(($epoch / 2629743)) $(($epoch / 604800)) $(expr $epoch / 86400) $(expr $epoch / 3600) $(($epoch / 60));
unset epoch;
@gsharp
gsharp / ls_to_props.sh
Created October 25, 2014 06:38
answer
ls | tr "\n" "," | sed 's/,$//' | sed 's/^/files=/' > files.txt; cat files.txt
@gsharp
gsharp / csv-dd.py
Last active August 29, 2015 14:06
do some csv parsing and aggregate values
# import sys library so we can do system level stuff like args and exits
import sys
# check for incoming file params...must have 2, 0 = script itself
if len(sys.argv) != 3:
sys.exit("usage: python path/to/csv-dd.py input.csv output.csv")
# get the command line arguments and stuff them into variables
thisFile, inFile, outFile = sys.argv
print "Thanks for running", thisFile,"!!"
@gsharp
gsharp / gist:5041046
Created February 26, 2013 18:56
my git hist alias
hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@gsharp
gsharp / gist:1597680
Created January 12, 2012 00:24
Prototyping in JS
<script type="text/javascript" charset="utf-8">
function Car (carMake,carModel,carYear) {
this.make = carMake;
this.model = carModel;
this.year = carYear;
};
Car.prototype = {
startEngine : function(){console.log("engine started")},
stopEngine : function(){console.log("engine stopped")},
sayMake : function(){console.log(this.make)},
@gsharp
gsharp / gist:1363064
Created November 14, 2011 01:53
smsContentWindow
<!DOCTYPE html>
<ol style="float: left;">
<li>thing <div style="display: none;">content my cool content</div></li>
<li>thing <div style="display: none;">content my cool content 2</div></li>
</ol>
<div class="content" style="float: right; border: 1px solid black">
nothing here yet
</div>