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
# stolen from http://effectif.com/ruby/update-your-project-for-ruby-19-hash-syntax | |
find . -name \*.rb -exec perl -p -i -e 's/([^:]):(\w+)\s*=>/\1\2:/g' {} \; |
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
# xs & ys are arrays of results in order of rank | |
def spearman(xs, ys) | |
# remove items that aren't common to both result sets | |
# these are mostly outliers anyway which we want to ignore | |
xs_common = xs.select{|i| ys.include? i } | |
ys_common = ys.select{|i| xs.include? i } | |
# calculate the mean of each set of ranks (simple sum/length calculation) | |
# as both are just the sum of ranks [1,2,3,4...] and have same length, | |
# we can figure it out based on an arithmetic sum |
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 | |
TABLE_NAME, | |
table_rows, | |
AVG_ROW_LENGTH, | |
data_length / 1024 /1024 / 1024 AS data_length_gb, | |
index_length / 1024 /1024 / 1024 AS index_length_gb, | |
(data_length / 1024 /1024 / 1024 + index_length / 1024 /1024 / 1024) AS total_length_gb | |
FROM information_schema.tables | |
ORDER BY table_schema, total_length_gb DESC; |
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
Thu 11:54:32 madlep@elastic1 ~ | |
$ curl -XPUT 'http://localhost:9200/foo/bar/1' -d '{"foo":{"bar":"boz"}}' | |
{"ok":true,"_index":"foo","_type":"bar","_id":"1","_version":1} | |
Thu 11:56:21 madlep@elastic1 ~ | |
$ curl -v "http://localhost:9200/foo/bar/1" | |
* About to connect() to localhost port 9200 (#0) | |
* Trying ::1... connected | |
* Connected to localhost (::1) port 9200 (#0) | |
> GET /foo/bar/1 HTTP/1.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
#!/usr/bin/env bash | |
set -e | |
if [ "$#" == "0" ]; then | |
echo "Usage mysqldbimport MYSQLGZIPPEDBACKUPFILE [args to pass to mysql]" | |
echo "e.g. mysqldbimport mybackup.sql.gz -u root my_database_name" | |
fi | |
BACKUP_FILE="$1" | |
shift |
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
#!/usr/bin/env bash | |
set -e | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist | |
rm /usr/local/var/mysql/ib_logfile* | |
cp /usr/local/Cellar/mysql/5.5.19/support-files/my-innodb-heavy-4G.cnf /usr/local/etc/my.cnf | |
sed -i -e 's/innodb_buffer_pool_size.*/innodb_buffer_pool_size = 4G/' /usr/local/etc/my.cnf | |
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist |
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
192.168.1.102 GET https://chronos.jimbolos.com.au/v1/journey-planner/o/%5B-37.809002,144.895660%5D%7CSeddon%20Station/d/%5B-37.818310,144.966965%5D%7CFlinders%20Street%20Station?departFrom=true&transferMethod=walk&transferMaxTime=10&inclTrain=true&inclTram=true&inclBus=true&inclVline=true&inclRegCoach=true&inclSkybus=true&token=97A431C0AD983ACF6A31DCDAD9AEAD845239FD77 | |
Host: chronos.jimbolos.com.au | |
User-Agent: PTV 1.0 rv:23032012 (iPhone; iPhone OS 5.1; en_AU) | |
Accept-Encoding: gzip | |
Connection: keep-alive | |
Proxy-Connection: keep-alive | |
<< 200 OK 977B | |
Cache-Control: private |
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 'spec_helper' | |
def version_of *args | |
Babushka::VersionOf::Helpers.VersionOf *args | |
end | |
describe "creation" do | |
it "should store name" do | |
version_of('ruby').name.should == 'ruby' | |
end |
NewerOlder