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
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)
@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
@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 / 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 / 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 / calculate_execution_time.rb
Created October 14, 2014 10:04
Circle CI parallelism execution time
container0 = <<-STR
Starting the build00:00
Start container (0)00:02config
checkout
Restore source cache00:03cache
Checkout using deploy key 00:07config
machine
Configure the build00:00cache
Restore cache00:19cache
dependencies
@phuongnd08
phuongnd08 / initd_redis
Created May 7, 2014 09:34
Redis init script for CentOS
#!/bin/sh
#
# redis init file for starting up the redis daemon
#
# chkconfig: - 20 80
# description: Starts and stops the redis daemon.
# Source function library.
. /etc/rc.d/init.d/functions
@phuongnd08
phuongnd08 / link.txt
Created November 9, 2012 03:30
Url checkout ngan luong
@phuongnd08
phuongnd08 / circle.yml
Created September 12, 2012 08:38
Deployment settings for sirinova on Circle CI
deployment:
production:
branch: master
heroku:
appname: sirinova-prod
commands:
- git push git@heroku.com:sirinova-prod.git
- heroku run rake db:migrate
- heroku restart
@phuongnd08
phuongnd08 / kienlanet
Created July 16, 2012 04:03
Deployment investigation
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 295 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3