This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LANG="zh_CN.UTF-8" | |
LANGUAGE="zh_CN:zh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netstat -an|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|awk '{ printf("%s\t%s\t",$2,$1); for (i = 0; i < $1; i++) {printf("*")}; print ""}' | |
netstat -alpn | grep :80 | awk '{print $5}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n | |
netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort –n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg-reconfigure tzdata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
有没有这样一个需求: | |
同时向几十上百台Linux服务器上传文件并执行命令,如果一个个来,那你就真是挨踢民工。程序员要发挥自己懒惰的个性,借用Net::SSH和net::SCP用Ruby写个脚本你会发现非常简单。 | |
Net::SSH和Net::SCP是两个Ruby操作SSH的gem包。Net::SSH相当于cmd,专门用于执行命令;Net::SCP专门用于传输文件。它们俩结合,可以做任何SSH client能做的事情。 | |
安装: | |
gem install net-ssh | |
gem install net-scp | |
以下所有代码都引用这段代码 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insert_medias(s){ | |
//var app_path="/kpy/dc"; | |
var app_path=""; | |
if(s==1){ | |
jsonurl=app_path+"/tempmedias/show"; | |
see_prefix=app_path+"/new_see/"; | |
$.getJSON(jsonurl, function(data) { | |
var items = []; | |
$.each(data, function(index, media) { | |
mediasrc=see_prefix+media.grid_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
我们本地的git目录下, 其实分为三种类型的文件: working tree、index file和native repository; | |
working tree就是我们当前修改的文件; | |
在使用"git add"命令后, git就会把diff合入index file(通过“git diff”来查看working tree与index file的差别); | |
再使用"git commit"命令, 把修改合入native repository("git commit -a"相当于"git add" + "git commit"; 在commit之前, 可以通过""git diff --cached"来查看index file与commit的差别); | |
其实, 还可以使用"git reset"命令来还原git节点. | |
"git reset --hard patch-hash-name" 可以使working tree、index file以及native repository彻底回复到指定的节点; | |
"git reset --mixed patch-hash-name" 可以使index file和native repository被还原; | |
"git reset --soft patch-hash-name" 可以使native repository被还原; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Place your new font in the folder app/assets/fonts. | |
Tell the server where the fonts are located and that it has to precompile assets with those specific file extensions. You probably only have to add the following lines to your config/environments/production.rb file since you are not precompiling your assets locally. If you are, then also add these lines to your config/environments/development.rb file: | |
# Add the fonts path | |
config.assets.paths << Rails.root.join('app', 'assets', 'fonts') | |
# Precompile additional assets | |
config.assets.precompile += %w( .svg .eot .woff .ttf ) | |
Declare your font in your css like so: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -F | |
iptables -X | |
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -t nat -F | |
iptables -t nat -P PREROUTING ACCEPT | |
iptables -t nat -P POSTROUTING ACCEPT | |
iptables -t nat -P OUTPUT ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu upstart file at /etc/init/penroll.conf | |
start on runlevel [2345] or net-device-up IFACE!=lo | |
stop on runlevel [06] | |
env PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin | |
chdir "/data/sites/kpy" | |
exec puma -e production -p 8080 | |
respawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# | |
# rc.local | |
# | |
# This script is executed at the end of each multiuser runlevel. | |
# Make sure that the script will "exit 0" on success or any other | |
# value on error. | |
# | |
# In order to enable or disable this script just change the execution | |
# bits. |