Skip to content

Instantly share code, notes, and snippets.

teddy1004 /
Created Feb 17, 2017 — forked from xdamman/
Install latest ffmpeg on ubuntu 12.04 or 14.04
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
teddy1004 /
Created Feb 7, 2017 — forked from ashrithr/
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.


  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
teddy1004 / timestamp.go
Created Jan 17, 2017 — forked from bsphere/timestamp.go
UNIX timestamps in Golang
View timestamp.go
package timestamp
import (
type Timestamp time.Time
View handler.rb
class Handler
instrument :ping, :fetch_feeds
def ping(req, _)
# …
def fetch_feeds(req, _)
# …
teddy1004 / ctags.setup
Created Aug 10, 2016 — forked from nazgob/ctags.setup
ctags setup on mac
View ctags.setup
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
View scorer.rb
# 需求说明
# 后端调用打分服务,在 Rails app 中和打分服务建立一个 WebSocket 连接
# 传输音频流数据到打分服务中
# 打分服务完成打分后会通过 WebSocket 传回打分数据
# 将拿到的打分数据返回到具体业务中
class Scorer
WS_URL = "ws://localhost:8081".freeze
# 实现打分的功能
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
View camera.html
<!DOCTYPE html>
<title>HTML5 Camera Fun</title>
<script src=""></script>
<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<script type="text/javascript">
// Wrapper around MPL-licensed
// to support JavaScript typed arrays since binary strings are not supported in IE 10
var createBinaryFile = function(uintArray) {