Skip to content

Instantly share code, notes, and snippets.

View phuongnd08's full-sized avatar

Phuong Nguyen phuongnd08

  • Farmer
  • Ho Chi Minh City
View GitHub Profile
@phuongnd08
phuongnd08 / pnl_spec.rb
Last active August 29, 2015 14:07
example spec for testing lua code
require 'spec_helper'
describe "lua::calculate_pnl" do
context "prices is increasing" do
it "returns positive profit" do
pnl = Wolverine.util.calcualte_pnl([1, 2, 3])
pnl.should > 0
end
# more verifications
@phuongnd08
phuongnd08 / currenct_crane.yml
Last active August 29, 2015 14:08
Example crane configurations
containers:
redis:
dockerfile: docker/redis
image: docker-redis
run:
volume:
- /var/data/myapp/redis:/data
detach: true
memcached:
dockerfile: docker/memcached
@phuongnd08
phuongnd08 / install_docker.sh
Last active August 29, 2015 14:08
Install docker 1.3.0 on CentOS
#!/bin/bash
if ! which wget > /dev/null; then
yum install -y wget
fi
export DOCKER_VERSION=1.3.0
pushd /tmp
if [ ! -f /usr/bin/docker ]; then
@phuongnd08
phuongnd08 / gist:828ce988e405fb0c10dc
Created January 27, 2015 09:20
fleet infinite loop
INFO[6bff69a4] Finished in 5.502 seconds with exit status 0 (successful).
INFO[87cf85d8] Running /usr/bin/env fleetctl --debug start bitcoind.service on 128.199.106.149
DEBUG[87cf85d8] Command: cd /home/core/www/vax-bitcoin-server/releases/20150127091639 && /usr/bin/env fleetctl --debug start bitcoind.service
DEBUG[87cf85d8] 2015/01/27 09:17:41 INFO client.go:353: etcd: sending HTTP request GET http://127.0.0.1:4001/v2/keys/_coreos.com/fleet/machines?consistent=true&recursive=true&sorted=true
DEBUG[87cf85d8] 2015/01/27 09:17:41 INFO client.go:360: etcd: recv response from GET http://127.0.0.1:4001/v2/keys/_coreos.com/fleet/machines?consistent=true&recursive=true&sorted=true: 307 Temporary Redirect
DEBUG[87cf85d8] 2015/01/27 09:17:41 INFO client.go:353: etcd: sending HTTP request GET http://10.130.172.56:4001/v2/keys/_coreos.com/fleet/machines?consistent=true&recursive=true&sorted=true
DEBUG[87cf85d8] 2015/01/27 09:17:41 INFO client.go:360: etcd: recv response from GET http://10.130.172.56:4001/v2/keys/_co
REDIS_WEBSOCKET_URL = ENV['REDIS_WEBSOCKET'] || "redis://localhost:6379/0"
REDIS_SIDEKIQ_URL = ENV['REDIS_SIDEKIQ'] || "redis://localhost:6379/0"
Redis.current = Redis.new(url: REDIS_SIDEKIQ_URL, driver: :hiredis)