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
# My ISP-provided fiber optical modem broadcasts a line of a poem every ten seconds. Here's the tcpdump of the complete poem. | |
# The optical modem is made by Shanghai Nokia-Bell Co.,Ltd and its model number is G-140W-UD. It's provided by my ISP, China Unicom in Shenzhen. | |
$ tcpdump -i vlan10 ether proto 0x8300 | |
15:59:00.720301 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72: | |
0x0000: 0000 0000 e4ea 8386 d93c 5468 6520 6461 .........<The.da | |
0x0010: 7920 4920 6c6f 7374 206d 7920 7665 7279 y.I.lost.my.very | |
0x0020: 2066 6972 7374 2074 6f6f 7468 2c00 0000 .first.tooth,... | |
0x0030: 0000 0000 0000 0000 0000 .......... | |
15:59:10.740778 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72: |
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/bash | |
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory | |
# Requires lame | |
# With Homebrew on Mac OS X: brew install lame | |
SHOW_AUTHOR="ATP" | |
EPISODE_NUMBER=104 | |
EPISODE_TITLE="Minutiæ" |
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
[peername] | |
proto = nacltai | |
proto_publickey = REMOTE_PUBKEY | |
proto_privatekey = LOCAL_PRIKEY | |
local = tuntap | |
local_interface = tunnel | |
peer = udp | |
peer_remoteaddr = REMOTE_IP | |
peer_remoteport = 8000 | |
peer_localaddr = 0.0.0.0 |
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
# A xterm-256color based TERMINFO that adds the escape sequences for italic. | |
# | |
# Install: | |
# | |
# tic xterm-256color-italic.terminfo | |
# | |
# Usage: | |
# | |
# export TERM=xterm-256color-italic | |
# |
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 test(state): | |
' test if the state is final ' | |
return all(d == 0 or d == 2 for d in state) | |
def next(state, cross=2): | |
' generate all possible moves from the current state ' | |
for i, d in enumerate(state): | |
if d == 1: | |
l = left(state, i, cross) |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
/* | |
* common import used for drawing. | |
*/ | |
import java.awt.Color; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.Dimension; | |
import java.awt.event.ActionListener; | |
import java.awt.event.ActionEvent; |
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 | |
class ZhihuDev(Developer) : | |
@property | |
def characteristics(self): | |
return set(["Teamwork", "Devoted", "Creative"]) | |
@property | |
def skills(self) : |
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
// Generic factorial function | |
// require Scala 2.8 | |
def factorial[T](n: T)(implicit m: Numeric[T]): T = { | |
import m._ | |
if (n == zero) one else n * factorial(n-one) | |
// this is not tail-optimized | |
// StackOverFlow for n > 26,800 BigInt on my JVM (1.6 OS X) | |
} |