Skip to content

Instantly share code, notes, and snippets.

View wjimenez5271's full-sized avatar

William Jimenez wjimenez5271

  • San Jose, CA
  • 12:32 (UTC -07:00)
View GitHub Profile
@wjimenez5271
wjimenez5271 / keybase.md
Created July 18, 2015 17:15
keybase.md

Keybase proof

I hereby claim:

  • I am wjimenez5271 on github.
  • I am wjimenez5271 (https://keybase.io/wjimenez5271) on keybase.
  • I have a public key whose fingerprint is 0CE3 E8BD E183 CE16 6166 D898 1FCE 33EC 418F 4FD7

To claim this, I am signing this object:

@wjimenez5271
wjimenez5271 / wemo_data_sample.csv
Created June 26, 2015 17:02
wemo_data_sample.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 7. in line 1.
Exported Data for WeMo Insight
Last Updated,Device Name,Device MAC,Signal Strength (%),Energy Cost per kWh,Currency,Threshold (Watts)
2015/06/25 21:58,WeMo Insight,EC1A59F7EF3C,31,0.11100,$,8
Daily Usage Summary
Date,Time ON (Hours:Minutes),Power Consumption ON (kWh),Time STANDBY (Hours:Minutes),Power Consumption STANDBY (kWh),Average Day Connected Device is ON (Hours),Average Power When ON (Watts),Estimated Monthly Cost,Day's Cost,Energy Cost per kWh
2015/06/25,1:0,0.06486,0:58,0.00084,2.77423,66,0.62344,0.00729,0.11100
2015/06/24,3:31,0.22614,0:28,0.00120,2.75671,66,0.62661,0.02524,0.11100
2015/06/23,2:44,0.17470,1:15,0.00000,2.73232,67,0.62963,0.01939,0.11100
2015/06/22,0:0,0.00000,3:59,0.00000,2.72940,66,0.63269,0.00000,0.11100
@wjimenez5271
wjimenez5271 / check_tmux_session.sh
Last active August 29, 2015 14:21
check_tmux_session.sh
if ! { [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; } then
sessions="$(tmux list-sessions 2> /dev/null)"
if [ $? -eq 0 ]
then
echo "------------- you have open tmux sessions --------------"
echo "$sessions"
echo "--------------------------------------------------------"
fi
fi
Reading config file {:file=>"logstash/agent.rb", :level=>:debug, :line=>"326", :method=>"local_config"}
Compiled pipeline code:
@inputs = []
@filters = []
@outputs = []
@periodic_flushers = []
@shutdown_flushers = []
@input_lumberjack_1 = plugin("input", "lumberjack", LogStash::Util.hash_merge_many({ "port" => 5043 }, { "ssl_certificate" => ("/opt/mycert.crt") }, { "ssl_key" => ("/opt/mykey.key") }))
input {
lumberjack {
port => 5043
# The paths to your ssl cert and key
ssl_certificate => "mycert"
ssl_key => "mykey"
}
}
filter {
$ knife actor map; knife group show admin
Found 1 users and 1 clients
wrote map to 'actor-map.yaml'
ERROR: The object you are looking for could not be found
Response: Cannot load group admin
$ cat actor-map.yaml
---
:user_map:
:users:
@wjimenez5271
wjimenez5271 / .bash_profile
Created October 6, 2014 17:28
Random Password Generator for Bash (OSX)
# Borrowed from http://www.commandlinefu.com/commands/view/4183/generate-random-password
function randpass() {
cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 16; echo
}
@wjimenez5271
wjimenez5271 / gist:74df2b16b540a7d9de0c
Created May 29, 2014 17:04
haproxy stats parsing
['']
index: 0
pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,
['pxname', 'svname', 'qcur', 'qmax', 'scur', 'smax', 'slim', 'stot', 'bin', 'bout', 'dreq', 'dresp', 'ereq', 'econ', 'eresp', 'wretr', 'wredis', 'status', 'weight', 'act', 'bck', 'chkfail', 'chkdown', 'lastchg', 'downtime', 'qlimit', 'pid', 'iid', 'sid', 'throttle', 'lbtot', 'tracked', 'type', 'rate', 'rate_lim', 'rate_max', 'check_status', 'check_code', 'check_duration', 'hrsp_1xx', 'hrsp_2xx', 'hrsp_3xx', 'hrsp_4xx', 'hrsp_5xx', 'hrsp_other', 'hanafail', 'req_rate', 'req_rate_max', 'req_tot', 'cli_abrt', 'srv_abrt', '']
pxname
index: 0
svname
index: 1
qcur
May 27, 2014 2:07:13 PM jenkins.plugins.hipchat.StandardHipChatService publish
WARNING: Error posting to HipChat
java.net.UnknownHostException: https
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:407)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
at hudson.util.NoClientBindSSLProtocolSocketFactory.createSocket(NoClientBindSSLProtocolSocketFactory.java:135)
@wjimenez5271
wjimenez5271 / gist:8230340
Created January 3, 2014 00:43
pig_latin_translate.py
#define the suffix we'll use in pig latin
pyg = 'ay'
#ask for input of the word to translate
original = raw_input('Enter a word:')
#santize input and check to see if word starts with a vowel or consonant
if len(original) > 0 and original.isalpha():
original = original.lower()
print "you entered: " + original