Skip to content

Instantly share code, notes, and snippets.

View BenKanouse's full-sized avatar
🏠
Working from home

Benjamin Kanouse BenKanouse

🏠
Working from home
View GitHub Profile
#!/usr/bin/env ruby
class Pi
def self.guess(n)
puts "====#{RUBY_VERSION}===="
in_circle = self.no_count(n)
4 * in_circle / n.to_f
end
def self.no_count(n)
Document currently unavailable: #<Typhoeus::Response:0x000000001198c6a8 @options={:httpauth_avail=>0, :total_time=>0.19566, :starttransfer_time=>0.009858, :appconnect_time=>0.0, :pretransfer_time=>0.000559, :connect_time=>0.00051, :namelookup_time=>4.8e-05, :redirect_time=>0.0, :effective_url=>"http://10.10.12.157:8090/utility-ws/pdfGeneration/getWebAdmitPDF/instances/6370/applicants/67480382/association_orgs/7311?hash=3ad513bb18f3e1734048d25669e8910e9ac007984773cafad45fa57c6a94d130&id=515&timestamp=2018-04-03T17%3A14%3A14-04%3A00", :primary_ip=>"10.10.12.157", :response_code=>503, :request_size=>408, :redirect_count=>0, :return_code=>:ok, :response_headers=>"HTTP/1.1 100 Continue\r\nContent-Length: 0\r\n\r\nHTTP/1.1 503 Service Unavailable\r\nExpires: 0\r\nCache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nX-XSS-Protection: 1; mode=block\r\nPragma: no-cache\r\nX-Frame-Options: DENY\r\nDate: Tue, 03 Apr 2018 21:14:14 GMT\r\nConnection: keep-alive\r\nVary: Accept-Encoding\r\nX-Content-Type-Optio
#!/usr/bin/env ruby
has_bros = Dir.entries(Dir.pwd).include? "bros.txt"
if has_bros
puts "that's enough with the Bros"
exit(1)
else
exit(0)
end
@BenKanouse
BenKanouse / prompt
Created September 13, 2012 20:12
configs for prompt (color reference in comments)
c_quiet='\[\e[0;37m\]'
c_reset='\[\e[0m\]'
c_path='\[\e[0;92m\]'
c_host='\[\e[0;95m\]'
c_user='\[\e[0;93m\]'
c_time=${c_path}
export PS1="\n${c_user}\u${c_quiet}@${c_host}\h${c_quiet}:${c_path}\w\n${c_time}\t${c_quiet}-> ${c_reset}"
### colors reference