This file contains 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 python | |
# encoding: utf-8 | |
# Name: Chinese Word Counter | |
# Description: This is a word counter for Chinese. It reads text from stdin, | |
# filters white spaces (including the full-width Chinese blank-space character), | |
# and then counts the remaining characters. In my tests, it usually produces | |
# the same result as WPS. It may be useful for some writers. | |
# Example: zwc.py < foo.txt | |
# Author: physacco |
This file contains 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
-- $ lua hash2array.lua | |
-- print a table that contains numbers and strings only | |
local f_log_hash = function(hash, name) | |
if name ~= nil then | |
print(name .. ':') | |
end | |
for k, v in pairs(hash) do | |
print(k, ' => ', v) | |
end |
This file contains 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 | |
# goagent: GoAgent init script for Redhat/Fedora. | |
# Written by physacco. 2013/03/01 | |
# To start at boot time: | |
# 1. copy this file to /etc/init.d/goagent | |
# 2. chkconfig goagent on | |
# --------------------- |
This file contains 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" | |
"net/http" | |
) | |
type Hello struct{} |
This file contains 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 ( | |
"os" | |
"fmt" | |
"net" | |
"bufio" | |
) | |
func handleConnection(conn net.Conn) { |
This file contains 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 ( | |
"os" | |
"fmt" | |
"net" | |
"time" | |
"bufio" | |
) |
This file contains 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 | |
GOROOT="/home/i/src/go" | |
VIMFILES="/usr/share/vim/vimfiles" | |
mkdir -p $VIMFILES/autoload/go | |
cp -i $GOROOT/misc/vim/ftdetect/gofiletype.vim $VIMFILES/ftdetect/ | |
cp -i $GOROOT/misc/vim/syntax/go.vim $VIMFILES/syntax/ | |
cp -i $GOROOT/misc/vim/syntax/godoc.vim $VIMFILES/syntax/ | |
cp -i $GOROOT/misc/vim/autoload/go/complete.vim $VIMFILES/autoload/go/ |
This file contains 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 | |
# Tested on ruby 1.9.2 | |
class HTTPNotFound < Exception | |
end | |
class MimeTypes | |
HTML = "text/html; charset=utf-8" | |
JAVASCRIPT = "application/javascript: charset=utf-8" | |
BINARY = "application/octet-stream; charset=binary" |
This file contains 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 ( | |
"os" | |
"fmt" | |
"flag" | |
) | |
func main() { | |
help := flag.Bool("help", false, "Print help message") |
This file contains 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 ( | |
"io" | |
"os" | |
) | |
func main() { | |
// Open a file for reading | |
// The associated file descriptor has mode O_RDONLY. |
OlderNewer