Skip to content

Instantly share code, notes, and snippets.

@riobard
riobard / tcpdump.txt
Last active Apr 8, 2021
Poem lines broadcast by my ISP-provided fiber optical modem
View tcpdump.txt
# 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:
View encode-podcast.sh
#!/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æ"
View 0. local.conf
[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
View xterm-256color-italic.terminfo
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
View cross-match-sticks.py
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)
View gist:3143441

This is a section heading

foo bar spam!

another section heading

hello world!

@riobard
riobard / hack.sh
Created Apr 1, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/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
#
@riobard
riobard / KochGen.java
Created Mar 20, 2012
Koch Snowflake Generator using Stack based on Linked List
View KochGen.java
/*
* 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;
View ZhihuDev.py
#!/usr/bin/env python
class ZhihuDev(Developer) :
@property
def characteristics(self):
return set(["Teamwork", "Devoted", "Creative"])
@property
def skills(self) :
@riobard
riobard / factorial.scala
Created Mar 21, 2010
Scala 2.8 generic Numeric type
View factorial.scala
// 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)
}