{
"message" => "hello world",
"@version" => "1",
"@timestamp" => "2014-04-22T23:03:14.111Z",
"type" => "stdin",
"host" => "hello.local"
}
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 | |
# SSH into an EC2 instance by name | |
# Author: [email protected] (SoThree.com). | |
set -e | |
if [ $# -lt 1 ] | |
then | |
echo "Usage: `basename $0` instance_name" | |
exit 1 | |
fi |
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
# Make sure you have Mercurial and Git installed | |
git clone https://github.com/rabbitmq/rabbitmq-public-umbrella.git | |
cd rabbitmq-public-umbrella | |
make co | |
cd rabbitmq-web-stomp | |
git clone https://github.com/jshiell/rabbitmq-web-stomp.git | |
make | |
cd dist |
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
class Stopwatch | |
def initialize() | |
@start = Time.now | |
end | |
def elapsed_time | |
now = Time.now | |
elapsed = now - @start | |
puts 'Started: ' + @start.to_s |
This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.
All the relevant code is in https://github.com/ruby/ruby/blob/master/gc.c
default: 10000
The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).
(todo: figure out how big a slot is. i think the answer can be infered from this code.)
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
var mysql = require('mysql') | |
, bcrypt = require('bcrypt') | |
, db = { | |
host: 'localhost', | |
user: 'root', | |
database: 'prod' | |
}; | |
function checkUser(email, password, callback) { | |
var connection = mysql.createConnection(db); |
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
cat datasets/auto_mpg.csv | python csv2vw.py car_name mpg > auto_mpg.vw | |
cat auto_mpg.vw | vw -f auto_mpg.sgd --sgd --loss_function=squared | |
cat auto_mpg.vw | vw -kc -f auto_mpg.sgd --sgd --passes 10 --loss_function=squared | |
cat auto_mpg.vw | vw -kc -f auto_mpg.sgd --sgd --passes 10 --loss_function=squared | |
cat auto_mpg.vw | vw -kc -f auto_mpg.bfgs --bfgs --hessian_on --passes 100 --loss_function=squared | |
cat auto_mpg.vw | vw -kc -i auto_mpg.sgd -f auto_mpg.hybrid --bfgs --hessian_on --passes 100 --loss_function=squared | |
head -n 350 auto_mpg.vw > auto_mpg.vw.train | |
tail -n 48 auto_mpg.vw > auto_mpg.vw.test |
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
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
# Will include all hosts the playbook is run on. | |
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
- name: "Build hosts file" | |
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
when: hostvars[item].ansible_default_ipv4.address is defined | |
with_items: groups['all'] |
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
function byteLength(str) { | |
// returns the byte length of an utf8 string | |
var s = str.length; | |
for (var i=str.length-1; i>=0; i--) { | |
var code = str.charCodeAt(i); | |
if (code > 0x7f && code <= 0x7ff) s++; | |
else if (code > 0x7ff && code <= 0xffff) s+=2; | |
if (code >= 0xDC00 && code <= 0xDFFF) i--; //trail surrogate | |
} | |
return s; |
OlderNewer