This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sort -rk 2 gets reverse sort order, key = 2nd field | |
cat ./output/* | sort -rk 2 | more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep -vE removes lines matching the following expression | |
# sed is trimming leading whitespace | |
# awk is prepending "* " to each line ($0 is the entire line) | |
git log | grep -vE '^(Author|Date|commit|\w*$)' | sed 's/^\s*//g' | awk '{print "* " $0}' | head -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir playground | |
mkdir playground/src | |
mkdir playground/classes | |
echo playground playground/src playground/classes | xargs mkdir | |
# mkdir: cannot create directory `playground': File exists | |
# mkdir: cannot create directory `playground/src': File exists | |
# mkdir: cannot create directory `playground/classes': File exists | |
# Bonus points for DRYing the "playground" part...? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __boardLog(self): | |
"""Returns the absolute path to the server logfile as a string. | |
""" | |
logFile = '''//{path}/c$/Board/Dataset/Log/Dtb_{dbname}_{date}.log'''.format( | |
path = self.board_server | |
, dbname = self.dbname | |
, date = date.today().strftime('%Y%m')) | |
return logFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clean_line some_text | |
# Takes a comma delimited string, returns an array of fields with leading | |
# and trailing whitespace stripped out. | |
some_text.gsub(/\"|\n/, "").split(',').each { |x| x.strip! } | |
end | |
def spit_line counter, some_line | |
# Takes a counter and an array of strings, prints them in counter,strings | |
# CSV format. | |
print "#{counter}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game_log = new Array(); | |
go = function (){ | |
x = Math.floor(Math.random() * 11) + Math.floor(Math.random() * 11); | |
return x; | |
}; | |
execute_n_times = function(n) { | |
for( i = 0; i < n; i++){ | |
single_roll = go(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery ($) -> | |
window.Plant = Backbone.Model.extend | |
testFun: (name) -> | |
return "Hello, #{name}" | |
vitals: -> | |
return @get 'vitals' | |
window.PlantView = Backbone.View.extend | |
tag : 'li' | |
className : 'plant' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
REQUIREMENTS: | |
* A Twilio account | |
* Python with the twilio library (`pip install twilio`) | |
* A purchased phone number on twilio to serve as your "from" number ($1/mo) | |
* Some twilio credits to pay for the $.01/msg SMS fees | |
The python-twilio library uses OS-level environment variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'twilio-ruby' | |
class SMSSender | |
def initialize | |
# put your own credentials here | |
@account_sid = ENV['TWILIO_ACCOUNT_SID'] | |
@auth_token = ENV['TWILIO_AUTH_TOKEN'] | |
@SMS_RECIPIENT = "+REDACTED" # My google voice number | |
@SMS_SENDER = "+REDACTED" # My paid twilio number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'ruby_gntp' | |
GNTP.notify({ | |
:app_name => "CLI Alert", | |
:title => "CLI Alert", | |
:text => ARGV.join(' '), | |
}) |