- Install homebrew if you don't have it already: http://mxcl.github.com/homebrew/
- Run
brew install vpnc --hybrid
- Check if you already have virtual tunnel interfaces, run
ls /dev/tun*
. If there are none, install "Tun Tap OSX" (see below) - Go to https://www.rz.uni-konstanz.de/angebote/e-mail/usermanager/ and login, then download both the certificate (you need the .pem file) and vpn profile
- Run
openssl x509 -in <certificateFile>.pem -noout -hash
- Rename
<certificateFile>.pem
to the output of (5) with.pem
as extension - Move the
.pem
certificate to a permanent location, e.g./etc/ssl/certs/
- Open
/usr/local/etc/vpnc/default.conf
in your favorite text editor, delete the contents - Run
pcf2vpnc /.pcf
and paste the output to your open text editor
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
for f in "$@" | |
do | |
echo "`basename $f`" >> /tmp/echo.log | |
/usr/local/bin/ffmpeg -i "$f" "${f%.*}.mp3" | |
done |
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
# only display markdown result | |
/Users/yangbin/bin/qrsync /Users/yangbin/bin/qiniu-conf.json 2>&1 | grep "Put" | awk -F"[:]" '{printf "![](http://xbin999.qiniudn.com/%s )\n", $6 }' | |
# replace the original log with markdown format | |
/Users/yangbin/bin/qrsync /Users/yangbin/bin/qiniu-conf.json 2>&1 |sed -e 's/\(=> xbin999:\)\(.*\)/=> ![](http:\/\/xbin999.qiniudb.com\/\2\)/' |
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
grep -- "- tools" *.md | awk -F"[:]" '{print $1;}'|xargs sed -ig 's/-\ tools/-\ tool/g' |
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 | |
require 'net/http' | |
require 'uri' | |
def fetch(uri_str, limit = 10) | |
# You should choose better exception. | |
raise ArgumentError, 'HTTP redirect too deep' if limit == 0 | |
url = URI.parse(uri_str) | |
req = Net::HTTP::Get.new(url.request_uri) |
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
require 'optparse' | |
def du(dir, all, depth, dsize, fsize) | |
return if depth <= 0 | |
value = %x(du -sm \'#{dir}\'/*) | |
h = Hash.new | |
value.split("\n").each{ |line| | |
arr = line.split(' ', 2) # only split into 2 pieces | |
h[arr[0].to_i] = arr[1] |
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/ruby | |
# Convert a Markdown file to HTML with Github Flavored Markdown(refer to https://gist.github.com/ttscoff/3732963), and publish it to wordpress. | |
# | |
# Requirements: json gem (`gem install json`) | |
# | |
# Input: filename | |
# Output: STDOUT | |
# Arguments: "-s" to speify title, -t to specify tags, -c to specify categories | |
# ruby post.rb -s "title" -t "tag1,tag2" -c "category1,category2" filename |
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
require 'rubygems' | |
require 'open-uri' | |
require 'json' | |
require 'net/http' | |
# Please note that the vanilla wp-json-api plugin does not support user authentication for create_post. | |
# Check out my fork for authentication support: https://github.com/Achillefs/wp-json-api | |
class Article | |
API_URI = 'http://mywpblog.com/api/' | |
API_USER = 'my_wp_username' |
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
def crawler( http, request_uri, user_regexp) | |
request = Net::HTTP::Get.new(request_uri) | |
response = http.request(request) | |
r = user_regexp.match(response.body.force_encoding('utf-8')) | |
return r | |
end |