Skip to content

Instantly share code, notes, and snippets.

View terrywang's full-sized avatar

Terry Wang terrywang

View GitHub Profile
@thbar
thbar / windows-solo.rb
Created February 8, 2012 21:02
solo.rb for windows node
tmp = 'c:/tmp/chef-solo'
file_cache_path tmp
data_bag_path File.join(tmp, 'data_bags')
cookbook_path [ File.join(tmp, 'site-cookbooks'),
File.join(tmp, 'cookbooks') ]
role_path File.join(tmp, 'roles')
@yegle
yegle / bash-invocation.md
Created January 5, 2012 11:44
Bash Shell启动方式与RC脚本

Bash Shell启动方式与rc脚本

Shell的不同分类

根据启动Bash Shell的方式不同,对Shell有两种分类方式

登录Shell与非登录Shell

根据Shell的启动方式不同,可以将Shell分为

@ikbear
ikbear / gist:1274521
Created October 10, 2011 02:36 — forked from xdite/gist:1273518
Octopress Wordpress converter
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
require 'ya2yaml'
include REXML
doc = Document.new(File.new(ARGV[0]))
@mhayes
mhayes / bootstrap.sh
Created July 30, 2011 20:01
Bootstrap CentOS 5.5 w/Ruby 1.9 and Chef
#!/bin/bash
# bootstrap ruby1.9 on a fresh RHEL5.5/CentOS5.5
# installs chef and bundler as well
# warning: this script does NOT make you breakfast
#enable EPEL repo, some packages (i.e. ruby-mysql) depend on this
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
RUBY_19_VERSION="ruby-1.9.2-p180"
@smoser
smoser / README.md
Last active October 12, 2020 17:14
ubuntu-auto-install: install a ubuntu image with kvm

Ubuntu Auto Install

This allows user to do automated installation of ubuntu. Provided here a a few different files/scripts for making this easier.

I've used this to verify that d-i kernel and initramfs from -proposed work as shown in bug 1511497.

The provided 'preseed' below can be used as a fully automated installation of ubuntu. Boot with qemu like:

note python web server is useful for this (python -m SimpleHTTPServer 9999)

@SaitoWu
SaitoWu / fibers.rb
Created June 28, 2011 05:47
ruby fibers exercise
require 'fiber'
fib = Fiber.new do
v = 0
loop do
v += 1
Fiber.yield v
v.times { print "-"}
puts v
end
@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
@SaitoWu
SaitoWu / eigenclass.rb
Created March 16, 2011 07:53
some ruby meta programming demo.
#Person
class Person
end
#class method
class Person
def self.address
puts "hangzhou"
end
end
@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`
@colinux
colinux / subtitles-renamer.sh
Created January 27, 2011 23:21
Rename subtitles files according to tv shows names found in a directory
#!/bin/bash
# Renames subtitles files according to tv shows names found in a directory
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive)
#
# Usage:
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer
# Chmod +x it
# cd ~/YourHolidaysTvShowsWithSubtitles
# subtitles-renamer