This file contains hidden or 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
| [user] | |
| name = Josh Stanfield | |
| email = [email protected] | |
| [core] | |
| editor = vim | |
| [alias] | |
| lol = log --graph --decorate --pretty=oneline --abbrev-commit --all | |
| l10 = log --pretty=oneline --abbrev-commit --all --decorate --graph --max-count=10 | |
| add-modified = status | grep 'modified' | ruby -e "puts STDIN.read.gsub(/.*:/,'').gsub(/\n/,'')" | xargs git add | |
| [color] |
This file contains hidden or 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
| Timeout::timeout(30) do | |
| socket = TCPSocket.new @hive_metastore_server, @hive_metastore_port | |
| begin | |
| socket.write("hello") | |
| socket.close_write | |
| x = socket.read | |
| #not sure when this would happen.... | |
| if x.nil? | |
| @monitored_app_state = :unknown |
This file contains hidden or 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
| select * from ( | |
| SELECT shows.* , ROW_NUMBER() OVER(PARTITION BY e.show_id ORDER BY e.airs_on) AS r | |
| FROM episodes e | |
| join shows s on s.id=e.show_id | |
| WHERE e.airs_on >= NOW() | |
| ) a | |
| where r=1 |
This file contains hidden or 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
| arr = [] | |
| 10.times do |i| | |
| cmd = "ping -c #{(rand(0)*10).to_i + 1} 127.0.0.1" | |
| pid = spawn(cmd, {out: "/dev/null"}) | |
| puts "#{pid}\n" | |
| arr[i] = Process.detach(pid) | |
| end | |
| arr.each { |t| t.join; print "#{t.status}: #{t.pid}" } |
This file contains hidden or 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
| create table report1 as | |
| select | |
| person_id, | |
| count(1) as purch_cnt | |
| from | |
| purchases | |
| where | |
| purchase_date > '2014-03-01' | |
| group by | |
| person_id |
This file contains hidden or 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 'wombat' | |
| Pry.config.pager = false | |
| set1 = Wombat.crawl do base_url "http://www.nhl.com"; path '/ice/news.htm?id=675589'; | |
| to_team 'xpath=//*[@id="cmstable_7607"]/tbody[1]/tr/td[3]//img/@src', :list | |
| to_players 'xpath=//*[@id="cmstable_7607"]/tbody[1]/tr/td[2]', :list | |
| from_team 'xpath=//*[@id="cmstable_7607"]/tbody[1]/tr/td[5]//img/@src', :list | |
| end |
NewerOlder