Skip to content

Instantly share code, notes, and snippets.

View teddy1004's full-sized avatar

Teddy teddy1004

View GitHub Profile
@teddy1004
teddy1004 / camera.html
Last active August 29, 2015 14:09 — forked from ammulder/camera.html
<!DOCTYPE html>
<head>
<title>HTML5 Camera Fun</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://www.nihilogic.dk/labs/exif/exif.js" type="text/javascript"></script>
<script src="http://www.nihilogic.dk/labs/binaryajax/binaryajax.js" type="text/javascript"></script>
<script type="text/javascript">
// Wrapper around MPL-licensed http://www.nihilogic.dk/labs/binaryajax/binaryajax.js
// to support JavaScript typed arrays since binary strings are not supported in IE 10
var createBinaryFile = function(uintArray) {
@teddy1004
teddy1004 / tmux-cheatsheet.markdown
Created December 2, 2015 16:31 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# 需求说明
# 后端调用打分服务,在 Rails app 中和打分服务建立一个 WebSocket 连接
# 传输音频流数据到打分服务中
# 打分服务完成打分后会通过 WebSocket 传回打分数据
# 将拿到的打分数据返回到具体业务中
class Scorer
WS_URL = "ws://localhost:8081".freeze
# 实现打分的功能
@teddy1004
teddy1004 / ctags.setup
Created August 10, 2016 02:48 — forked from nazgob/ctags.setup
ctags setup on mac
# 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"
@teddy1004
teddy1004 / handler.rb
Last active December 20, 2016 08:44
Handler
class Handler
instrument :ping, :fetch_feeds
def ping(req, _)
# …
end
def fetch_feeds(req, _)
# …
end
@teddy1004
teddy1004 / timestamp.go
Created January 17, 2017 13:13 — forked from bsphere/timestamp.go
UNIX timestamps in Golang
package timestamp
import (
"fmt"
"labix.org/v2/mgo/bson"
"strconv"
"time"
)
type Timestamp time.Time
@teddy1004
teddy1004 / kafka.md
Created February 7, 2017 08:55 — forked from ashrithr/kafka.md
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.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
@teddy1004
teddy1004 / install_ffmpeg_ubuntu.sh
Created February 17, 2017 02:55 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# 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