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
| #!/usr/bin/env ruby | |
| # Find duplicate files in specified directories and files and use | |
| # hardlink to keep only one copy. | |
| require 'digest' | |
| if ARGV.length < 1 | |
| name = `basename #{__FILE__}` | |
| puts "Usage: #{name.chomp} <path1> [path2 ...]" |
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
| # If you're looking into the C10M problem (10 million concurrent connections) | |
| # you might want to play with DPDK (Originally proprietry Intel, now open source) | |
| # | |
| # C10M: http://c10m.robertgraham.com/ | |
| # DPDK: http://dpdk.org/ | |
| # | |
| # This is a quick summary how to install dpdk on ubuntu | |
| # running inside virtualbox on a mac | |
| # On my Mac: |
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
| package main | |
| /* | |
| Observe different behavior of net.Listener.Accept on Linux and OS X. | |
| Steps: | |
| 1. Build this program on Linux or OS X. | |
| 2. Execute "ulimit -Sn 5" to limit the number of open file. (You may need to | |
| change the number to 6 or other values.) |
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
| require 'nokogiri' | |
| require 'open-uri' | |
| doc = Nokogiri::XML(open('https://itunesu.itunes.apple.com/WebObjects/LZDirectory.woa/ra/directory/courses/733644550/feed')) | |
| doc.css('entry').each do |e| | |
| title = e.css('title').first.text | |
| link = e.css('link').first.attributes["href"].value | |
| puts title | |
| puts link |
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/bash | |
| # Extract parsec benchmark run command. | |
| APPS="blackscholes bodytrack canneal swaptions fluidanimate" | |
| # Number of threads to run. | |
| NTHR="2 4" | |
| # Output file | |
| OUTPUT=cmd | |
| # Specify input data set. |
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
| [DEBUG] 2013/07/28 12:45:38 cli(127.0.0.1:53365) connected, total 1 clients | |
| [>>>>>] 2013/07/28 12:45:38 cli(127.0.0.1:53365) request GET www.taobao.com:80/ | |
| [DEBUG] 2013/07/28 12:45:39 cli(127.0.0.1:53365) connected to www.taobao.com:80 1 concurrent connections | |
| [<<<<<] 2013/07/28 12:45:39 cli(127.0.0.1:53365) response GET www.taobao.com:80/ 200 OK | |
| [DEBUG] 2013/07/28 12:45:39 cli(127.0.0.1:53365) close idle connections, remains 1 | |
| [DEBUG] 2013/07/28 12:45:39 cli(127.0.0.1:53367) connected, total 2 clients | |
| [DEBUG] 2013/07/28 12:45:39 cli(127.0.0.1:53368) connected, total 3 clients | |
| [DEBUG] 2013/07/28 12:45:39 cli(127.0.0.1:53369) connected, total 4 clients | |
| [>>>>>] 2013/07/28 12:45:39 cli(127.0.0.1:53367) request GET g.tbcdn.cn:80/??tb/global/1.0.5/global-min.css,tb/fp/1.1.4/first-screen-min.css,tb/fp/1.1.4/second-screen-min.css?t=20130711 | |
| [>>>>>] 2013/07/28 12:45:39 cli(127.0.0.1:53368) request GET g.tbcdn.cn:80/??tb/conve/0.0.5/common-min.css,tcc/tbr/1.0.18/tbr/common.css,tcc/tbr/1.0.18/tbr/widget/phone/phone. |
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
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| ) | |
| func main() { | |
| var ( | |
| k string // do assignment and read to this variable |
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
| Sub textspace() | |
| Dim slide As slide | |
| Dim shape As shape | |
| Dim text As TextRange2 | |
| For Each slide In ActivePresentation.Slides | |
| For Each shape In slide.Shapes | |
| If shape.HasTextFrame Then | |
| Set text = shape.TextFrame2.TextRange | |
| If Not IsNull(text) Then |
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
| // run with go test -test.bench Bench | |
| package main | |
| import ( | |
| // "fmt" | |
| "runtime" | |
| "sync" | |
| "sync/atomic" | |
| "testing" |
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
| # Install with: | |
| # bash < <(curl -L https://raw.github.com/gist/2005310) | |
| # | |
| # Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
| echo "Installing ruby-debug with ruby-1.9.3-p0 ..." | |
| curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
| curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |