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
有没有这样一个需求: | |
同时向几十上百台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
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
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
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
#encoding: utf-8 | |
require "net/http" | |
require "json" | |
require "xmlsimple" | |
class YixinController < ApplicationController | |
layout nil | |
skip_before_filter :verify_authenticity_token |
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
<xml> | |
<ToUserName>#{@to_user}</ToUserName> | |
<FromUserName>#{@from_user}</FromUserName> | |
<CreateTime>#{Time.now.to_i}</CreateTime> | |
<MsgType>news</MsgType> | |
<ArticleCount>#{@articles.count}</ArticleCount> | |
<Articles> | |
- @articles.each do |article| | |
- unless article.media_infos.blank? | |
- theone=article.media_infos.sample |
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
<xml> | |
<ToUserName>#{@to_user}</ToUserName> | |
<FromUserName>#{@from_user}</FromUserName> | |
<CreateTime>#{Time.now.to_i}</CreateTime> | |
<MsgType>news</MsgType> | |
<ArticleCount>1</ArticleCount> | |
<Articles> | |
<item> | |
<Title>凤城文化节有奖问答</Title> | |
<Description>快来参加吧</Description> |