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
| #!/bin/sh | |
| FILENAME='check_update.sh' | |
| URL='https://raw.github.com/gist/1950778' | |
| if [[ -f $FILENAME ]]; then | |
| echo 'Updating file in place...' | |
| curl --retry 3 --progress-bar --location --time-cond $FILENAME --remote-time --output $FILENAME $URL | |
| else | |
| echo 'File does not exist, downloading...' |
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
| # c = CSVBuilder.new ['column 1 name', 'column 2 name', 'column 3 name'] | |
| # rowdata.each do |r| | |
| # special_column = r.boolean ? 'YES' : 'NO' | |
| # c.add_row [special_column, r.name, r.date] | |
| # end | |
| # c.export('optional_filename.csv') | |
| require 'csv' | |
| require 'tempfile' |
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
| source :rubygems | |
| gem 'libusb' | |
| gem 'nokogiri' |
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 'open-uri' | |
| require 'json' | |
| tweeter = 'JasonFalls' | |
| keep_going = true | |
| page = 1 | |
| yes = 0 | |
| no = 0 | |
| while keep_going do |
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
| for pid in `ps aux | grep '[p]ool www' | awk '{print $2}'`; do | |
| head /proc/$pid/smaps | grep 'Rss' | awk '{print $2 $3}' | |
| done |
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
| #!/bin/bash | |
| SERVERS=( 8.8.8.8 8.8.4.4 209.244.0.3 209.244.0.4 ) | |
| for server in ${SERVERS[@]}; do | |
| date -u "+%Y-%m-%d %H:%M UTC : Testing $server" | |
| mtr -lrwc 20 -o 'LDRS NBAW V JMXI' $server | |
| done |
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
| libs = Dir.glob("#{ENV['MY_RUBY_HOME']}/lib/ruby/1.9.1/*.rb").map{|i| i.split('/').last.split('.').first} | |
| libs.reject!{|i| i == 'debug'} | |
| libs.reject!{|i| i =~ /tk/} | |
| libs.reject!{|i| i =~ /^[A-Z]/} | |
| libs.each do |lib| | |
| puts "Loading #{lib}" | |
| require lib | |
| end |
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
| FOr b3 w1ll pR0dUc+, c@ch3d 3n4b|3d, 83 w1t. WI5h 34513r (4(h3d 0R +HE, 15 m1t3 pr3f3|23nc35 n0w, 1T 8@d \/\/3b. |
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
| ChicagoVPS 2048 MB VPS | |
| $40 /year (special) | |
| Cachefly 100 MB Download: 3.36M/s in 30s | |
| ======================================================================== | |
| BYTE UNIX Benchmarks (Version 5.1.3) | |
| System: rails: GNU/Linux | |
| OS: GNU/Linux -- 2.6.32-042stab062.2 -- #1 SMP Wed Oct 10 18:28:35 MSK 2012 |
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
| namespace :import do | |
| desc 'Imports ZipCodes from geonames.org' | |
| task :zip_codes do | |
| require 'zip/zip' | |
| require Rails.root.join('config/environment.rb') | |
| ZIPFILE = Rails.root.join('tmp/zipcodes.zip') | |
| CSV_OPTS = {col_sep: "\t", headers: [:country_code, :postal_code, :place_name, :state_name, :state_code, :county_name, :county_code, :community_name, :community_code, :lattitude, :longitude, :accuracy]} | |
| if !File.exist?(ZIPFILE) |