Skip to content

Instantly share code, notes, and snippets.

View duobei's full-sized avatar
🐳
dingdong

Luca Zhang duobei

🐳
dingdong
View GitHub Profile
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@duobei
duobei / eigenclass.rb
Created October 16, 2012 14:52 — forked from SaitoWu/eigenclass.rb
some ruby meta programming demo.
#Person
class Person
end
#class method
class Person
def self.address
puts "hangzhou"
end
end
@duobei
duobei / runable.rb
Created October 16, 2012 14:52 — forked from SaitoWu/runable.rb
exec something on ruby.
#0> non-block call
Thread.new do
blahbla...
end
#1> 4 simple ways to call shell or cmd
`ps aux`
@duobei
duobei / proc.rb
Created October 16, 2012 14:52 — forked from SaitoWu/proc.rb
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
@duobei
duobei / shell_tips.md
Created November 21, 2012 08:34 — forked from flaneur2020/shell_tips.md
shell tips
  • gcc -M hello.c 可以得到某文件依赖的头文件。

  • grep processor /proc/cpu_info 显示当前的CPU数目

  • sudo shutdown -r now 重启机器

  • sshfs yourname@host:/path/to/your/dir ~/local sshfs挂载到本地

  • sudo -u fleuria bash: 切换用户

Ultimate OpenStack IceHouse Guide

This is a Quick Guide to deploy OpenStack IceHouse on top of Ubuntu 14.04, it is IPv6-Ready!

It is compliant with OpenStack's official documentation (docs.openstack.org).

The tenant's subnets are based on Neutron, with ML2 plugin and Single Flat Network topology, dual-stacked.

The Single Flat Network is the simplest network topology supported by OpenStack (I think). So, it is easier to understand and follow.

from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()
@duobei
duobei / README.md
Created August 31, 2020 03:48 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)