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 'rubygems' | |
| require 'activesupport' | |
| require 'bad_ass_extensions' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| class GitHubber | |
| attr_accessor :header, :name, :date, :date_string, :links, :post | |
| def initialize(hash, post) |
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
| # Usage: | |
| # git log | ruby git_commit_parser.rb | |
| # https://gist.github.com/881641 | |
| # By: Jason Amster | |
| # [email protected] | |
| require 'rubygems' | |
| require 'pp' | |
| logs = STDIN.read | |
| logs = logs.split("commit ") |
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
| header = "RAM Disk Price/Hour Price/Month" | |
| x = DATA.read.split("\n").map do |x| | |
| arr = x.split("\t") | |
| monthly = arr.last[1..-1].to_f * 24 * 30 | |
| arr << "$#{monthly}" | |
| arr.join("\t") | |
| end.join("\n") | |
| puts header |
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
| sudo iptables -A INPUT -i lo -j ACCEPT | |
| sudo iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT | |
| sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
| sudo iptables -A OUTPUT -j ACCEPT | |
| sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
| sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
| sudo iptables -A INPUT -p tcp --dport 4000 -j ACCEPT | |
| sudo iptables -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT | |
| sudo iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT | |
| sudo iptables -A INPUT -j REJECT |
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
| mv /etc/localtime /etc/localtime.bak | |
| cp /usr/share/zoneinfo/US/Eastern /etc/localtime |
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
| gems = <<-GEMS | |
| abstract (1.0.0) | |
| actionmailer (3.0.3, 2.3.10) | |
| actionpack (3.0.3, 2.3.10) | |
| activemodel (3.0.3) | |
| activerecord (3.0.3, 2.3.10) | |
| activeresource (3.0.3, 2.3.10) | |
| activesupport (3.0.3, 2.3.10) | |
| addressable (2.2.2) | |
| arel (2.0.6, 2.0.4) |
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
| def to_csv(array_of_ar_objects, delim=",") | |
| keys = array_of_ar_objects.first.attributes.keys | |
| puts keys.join(delim) | |
| array_of_ar_objects.map do |item| | |
| keys.map{|key| item.send(key)}.join(delim) | |
| end.join("\n") | |
| 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
| # I have this data | |
| sample <- c(0, 1, 1, 2, 2, 2, 4, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9) | |
| # I already grouped and counted it | |
| vals <- c(0,1,2,4,6,7,8,9) | |
| freqs <- c(1,2,3,1,1,6,3,4) | |
| # I want to use this, to do a histogram instead of on the original values | |
| # Not hist(sample) | |
| # but hist( vals, freas) |
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
| curl -s -XGET 'http://localhost:9200/_cluster/state?pretty=true' | |
| { | |
| "cluster_name" : "default", | |
| "master_node" : "539080ef-fc83-49e9-be3a-458a90367386", | |
| "blocks" : { | |
| }, | |
| "nodes" : { | |
| "539080ef-fc83-49e9-be3a-458a90367386" : { | |
| "name" : "Werewolf by Night", | |
| "transport_address" : "inet[/192.168.2.15:9300]", |
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
| [jasonamster]:~$ curl -s -XGET 'http://localhost:9200/_cluster/state?pretty=true' | |
| { | |
| "cluster_name" : "default", | |
| "master_node" : "539080ef-fc83-49e9-be3a-458a90367386", | |
| "blocks" : { | |
| }, | |
| "nodes" : { | |
| "539080ef-fc83-49e9-be3a-458a90367386" : { | |
| "name" : "Werewolf by Night", | |
| "transport_address" : "inet[/192.168.2.15:9300]", |