Skip to content

Instantly share code, notes, and snippets.

@caingougou
caingougou / gist:2092687
Created March 19, 2012 03:16
qooxddo blocker
var input = new qx.ui.form.Button("Test button", "qooxdoo/test.png");
var blocker = new qx.bom.Blocker();
blocker.setBlockerOpacity(0.5);
blocker.setBlockerColor("gray");
input.addListener("click", function(e){
blocker.block();
qx.event.Timer.once(function(e){
blocker.unblock();
}, window, 5000);
});
@caingougou
caingougou / gist:2092848
Created March 19, 2012 03:21
Network settings
ifconfig eth0 192.168.1.2
netmask 255.255.255.0
//设置IP地址192.168.1.2 子网掩码:255.255.255.0
routeadd default gw 192.168.1.1
//设置网关为192.168.1.1
@caingougou
caingougou / gist:2092885
Created March 19, 2012 03:22
Linux static IP address
vi /etc/netword/interface
# 添加
address 192.168.0.*
@caingougou
caingougou / gist:2092919
Created March 19, 2012 03:23
Email validation
function is_valid_email(email) {
return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email);
}
@caingougou
caingougou / gist:2132584
Created March 20, 2012 07:50
查看端口占用
lsof -i:[port]
netstate -apn | grep [port]
@caingougou
caingougou / gist:2155332
Created March 22, 2012 02:57
XFCE application menu folder
/usr/local/share/applications
/usr/share/applications
~/.local/share/applications
@caingougou
caingougou / vampire_numbers.rb
Created March 27, 2012 13:52
vampire numbers
#!/usr/bin/env ruby
require 'pp'
nums = (1...100).to_a
nums.each do |n|
nums.each do |m|
(n.to_s + m.to_s).split('').permutation().to_a.each do |p|
if ( p.join('') == (n*m).to_s )
@caingougou
caingougou / connect-to-nfs.sh
Created June 5, 2012 16:42
connect to nfs
mount -o soft,intr [ip]:/nfs nfs/
@caingougou
caingougou / replace in file using perl.sh
Created June 21, 2012 02:50
replace in file using perl
perl -p -i -e "s/[find]/[replace]/g" [files]