Server Software:
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 11 bytes
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" | |
) | |
type Handler func(int) | |
func test(handler Handler) { | |
handler(1) |
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 'digest/md5' | |
Dir['**/*']. | |
select {|f| File.file? f }. | |
group_by {|f| Digest::MD5.hexdigest(File.binread(f)).tap {|md5| STDERR.puts "#{f}: #{md5}" } }. | |
reject {|_, list| list.size == 1 }. | |
each {|_, v| puts "---\n#{v.join("\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
#/bin/bash | |
cd `mktemp -dt tmp` | |
git clone http://git.kernel.org/pub/scm/docs/man-pages/man-pages | |
cd man-pages | |
for f in man?/**/*.?; do mv -v $f `dirname $f`/linux.`basename $f`; done | |
sudo make install | |
cd .. | |
rm -rf man-pages |
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
sshtunnel() { | |
OPTIND=1 | |
PROGRAM=$0 | |
# Common default parameters | |
PROXY_USER=`whoami` | |
PROXY_SSH_PORT=22 | |
MONITOR_PORT=18524 | |
PROXY_PORT=8080 |
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 'httparty' # `gem install httparty` | |
require 'cgi' | |
require 'digest/md5' | |
require 'nokogiri' # `gem install nokogiri` | |
require 'pathname' | |
require 'set' | |
ROOT = Pathname File.expand_path(__dir__) | |
DOWNLOAD_PATH = ROOT.join 'Downloads' |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <errno.h> | |
#include <string.h> | |
#define ERROR_PRINTF(fmt, args...) { \ | |
fprintf(stderr, fmt, args); \ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <linux/limits.h> | |
#define ERROR_PRINTF(fmt, args...) {\ | |
fprintf(stderr, fmt, args); \ |
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 'rest_client' | |
require 'nokogiri' | |
HOST = 'http://moocs.nccu.edu.tw'.freeze | |
html = Nokogiri::HTML(RestClient.get(HOST + '/course/14/section/lecture').body) | |
html.css('li.lecture>.main>.title>a.link').each do |lecture| | |
href = lecture.attr('href') | |
title = lecture.css('.value').first.attr('title') | |
page = Nokogiri::HTML(RestClient.get(HOST + href).body) |
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
#include <stdio.h> | |
#include <time.h> | |
#include <string.h> | |
#include <pthread.h> | |
void *add_counter(void* c) { | |
int i; | |
for (i = 0; i < 10000; i++) { | |
(*(int*)c)++; | |
} |