Skip to content

Instantly share code, notes, and snippets.

View ouyangzhiping's full-sized avatar

Zhiping Yang ouyangzhiping

View GitHub Profile
@gka
gka / worldcup-network.gexf
Last active August 29, 2015 14:02
Network of 2014 World Cup teams, their players and the clubs they are playing in. Derived from the FIFA.com player database. Used to make this graphic: http://www.nytimes.com/interactive/2014/06/20/sports/worldcup/how-world-cup-players-are-connected.html?ref=worldcup
<?xml version="1.0" encoding="utf-8"?><gexf version="1.1" xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance">
<graph defaultedgetype="undirected" mode="static">
<attributes class="node" mode="static">
<attribute id="0" title="country_rank" type="integer" />
<attribute id="1" title="confederation" type="string" />
<attribute id="2" title="team_count" type="integer" />
<attribute id="3" title="country" type="string" />
<attribute id="4" title="premier" type="boolean" />
<attribute id="5" title="type" type="string" />
<attribute id="6" title="rank" type="integer" />
import twitter
import networkx as NX
import time
# Create an authenticated Api object in order to download user data
api_user='your_twitter_id'
api_pswd='your_twitter_password'
api=twitter.Api(username=api_user,password=api_pswd)
# The seed user to be analyzed
#!/usr/bin/ruby -w
require 'socket'
server = TCPServer.open(7788)
loop do
Thread.start(server.accept) do |client|
client.write "[Host]:[Port]> "
target = ""
while s = client.getc.chr
client.write s
# zh-CN translations for Typus (template)
# by ZoOL <http://github.com/zhooul>
zh-CN:
"A valid token is required": "需要验证令牌"
"Actions": "动作"
"Active": "已激活"
"Add": "新增"
"Add %{resource}": "新增 %{resource}"
"Add new": "新增"
@bmuller
bmuller / r.rb
Created January 3, 2011 19:05
r.rb
require 'formula'
class R <Formula
url 'http://cran.r-project.org/src/base/R-2/R-2.12.1.tar.gz'
homepage 'http://www.R-project.org/'
md5 '078e8d1179fc9a762e326e6da2725468'
depends_on 'readline'
def install
@evtuhovich
evtuhovich / .irbrc
Created March 22, 2011 11:33
My Irbrc file
require 'rubygems'
# Rails on-screen logging
def change_log(stream)
ActiveRecord::Base.logger = Logger.new(stream)
ActiveRecord::Base.clear_active_connections!
end
def show_log
@dvhthomas
dvhthomas / Markdown.sublime-build
Created May 3, 2011 22:58
Pandoc powered Sublime Text 2 build provider for Markdown files: HTML the easy way
{
"cmd": ["pandoc.exe", "--to=html", "--output=$file.html", "$file"],
"selector": "source.md"
}
@xdite
xdite / gist:1031760
Created June 17, 2011 16:35
Best Practice of Installing Ruby on Rails on Ubuntu 11.04 ( 2011 version )
  • 警告:請絕對不要跳著裝!*

系統套件

進行 Ubuntu 系統更新 / 安裝 MySQL

 > sudo apt-get update
 > sudo apt-get upgrade
 > sudo apt-get install git
@ouyangzhiping
ouyangzhiping / class_base_003.js.coffee
Created June 20, 2011 01:05 — forked from cnruby/class_base_003.js.coffee
HOW TO USE PROTOTYPE for CofffeeScript
# 理解JavaScript的prototype属性
#
# 类Dog - 类名称
# 属性name - 类Dog的对象属性
# 类属性species - 类Dog的类属性
# 对象dog_a - 类Dog的对象
# 对象dog_b - 类Dog的对象
#
# 类属性species是prototype对象的属性;
# 类Dog.prototype是实例对象共享的对象;
@cnruby
cnruby / class_base_004.js
Created June 20, 2011 05:30
HOW TO USE METHODS for CofffeeScript
// 理解类的方法
//
// 第一段代码是使用默认类,定义和使用函数
// 第二段代码是使用类<类Person>,定义和使用函数
//
// 函数吃 - 函数名称
// 属性修饰 - 属性名称
// 属性食品 - 属性名称
// 类人 - 类名称
// 对象道喜 - 类的对象名称