Skip to content

Instantly share code, notes, and snippets.

View fire9's full-sized avatar
🏠
Working from home

fire9 fire9

🏠
Working from home
View GitHub Profile
@benders
benders / README
Created July 4, 2012 01:17
Using Vagrant and puppet-rbenv
yourproject/
- Vagrantfile
- manifests/
- centos62-64.pp
- modules/
- rbenv/ <-- git submodule of https://github.com/alup/puppet-rbenv
@saga
saga / gist:4137880
Created November 24, 2012 00:54
appfog get youtube
#!/usr/bin/env python
import simplejson
import logging
import random
import re
import datetime
import string
import time
import sys
import urllib
@SaitoWu
SaitoWu / runable.rb
Created February 11, 2011 08:57
exec something on ruby.
#0> non-block call
Thread.new do
blahbla...
end
#1> 4 simple ways to call shell or cmd
`ps aux`
@SaitoWu
SaitoWu / proc.rb
Created March 17, 2011 14:44
magic ruby proc demo
def block_new
puts Proc.new.call
end
block_new{"hello"}
#slow practice
def herp_pass_block(&block)
derp_call_block &block
end
@killme2008
killme2008 / metaq_monitor.rb
Last active December 11, 2015 02:09
A script to monitor MetaQ queue size
####
# Description:a ruby script to monitor metaq queue size
# Requirements: zookeeper
# sudo gem install zookeeper
#
#####
require 'rubygems'
require 'zookeeper'
require 'socket'
@fcicq
fcicq / smartmachine-survival-guide-fcicq.markdown
Last active December 11, 2015 06:48
SmartMachine 生存指南 by fcicq

SmartMachine 生存指南

by fcicq, CC-BY

SmartMachine 是 Joyent 家的虚拟化方案.
SmartOS 主要的卖点是 ZFS + DTrace + Zones (SmartMachine) + KVM (运行 Linux, Windows 等).
实际上 SmartOS 是 Joyent 以 Solaris 为基础 (因为 OpenSolaris 项目被中止而改名 illumos) 打包的操作系统.

SmartOS 作为 HOST 时, 虽然支持 KVM 虚拟化, 但不支持突发的 vCPU.
而 SmartMachine 是基于 Zones 的 (存储则是 ZFS), 比较类似 Linux 平台下 OpenVZ 或者 LXC 的方案.
资源用量由调度器决定, 只需要修改配额 (ZFS 也支持在线扩展) 就可以伸缩, 所以伸缩不需要重启.

@xumingming
xumingming / how-ring-autoload-works.sh
Last active December 11, 2015 17:08
How ring's autoload works?
<rationalrevolt> With ring, can some one help me understand why passing a var
to run-jetty allows me to reload code and have it reflect
immediately? (run-jetty #'handler {:port 8080 :join? false})
[12:58]
<nDuff> rationalrevolt: passing the var object means it's involved in the
lookup, and can be substituted/replaced. [12:59]
*** bobbrahms1 (~Adium@pool-71-251-206-14.nwrknj.fios.verizon.net) has joined
channel #clojure [13:01]
*** bobbrahms (~Adium@pool-71-251-206-14.nwrknj.fios.verizon.net) has quit:
Read error: Connection reset by peer
@raggi
raggi / validate_local_cache.sh
Last active December 11, 2015 23:39
A script to validate your local gem cache against the public s3 repositories. If you find mismatches that contain both local and remote values, please post them in comments.
#!/usr/bin/env sh
if ! which md5sum > /dev/null; then
echo Install md5sum
exit 1
fi
if ! which curl > /dev/null; then
echo Install curl
exit 1
@fcicq
fcicq / cgmonitor.py
Last active December 13, 2015 21:18
cgminer monitor (use with cgminer 2.10+, please enable --api-listen --api-allow first)
# by fcicq <fcicq@fcicq.net> on 2013.2.18, Released under GPLv3
import socket
import urlparse
import urllib
import time
import math
CONV_4G = 4295.0 # 4096 or 4295
CONV_60_SHARE = CONV_4G / 60.0 # 4096 / 60 = 68.27 or 4295 / 60 = 71.58