Skip to content

Instantly share code, notes, and snippets.

@kennethklee
kennethklee / mashape-distributions-nginx.conf
Created September 7, 2016 20:17
Mashape distributions
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 65536;
}
Date: Fri May 13 21:32:57 UTC 2016
UTC: 1463175177
Backup File: db.20160513213257.sql.bak
@kennethklee
kennethklee / receive-stream.sh
Created April 5, 2016 15:55
Bash script to receive an nc stream from raspivid (~100ms delay)
while true; do nc -l -p 5000 | mplayer -fps 30 -cache 512 -; sleep 2; done
@kennethklee
kennethklee / wii_weight.py
Created April 5, 2016 15:52
Wii board weight code
#!/usr/bin/env python
import wiiboard
import pygame
import time
import sys
def main():
board = wiiboard.Wiiboard()
pygame.init()
# from http://stackoverflow.com/a/25472887/421912
import sys, os, pyaudio
from pocketsphinx import *
modeldir = "/usr/local/share/pocketsphinx/model"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', os.path.join(modeldir, 'hmm/en_US/hub4wsj_sc_8k'))
config.set_string('-dict', os.path.join(modeldir, 'lm/en_US/cmu07a.dic'))

Keybase proof

I hereby claim:

  • I am kennethklee on github.
  • I am kenneth (https://keybase.io/kenneth) on keybase.
  • I have a public key whose fingerprint is 66E6 062C 6E19 7C2E 9673 A390 75A5 67A0 C4BB 76AC

To claim this, I am signing this object:

@kennethklee
kennethklee / nginx.conf
Created September 28, 2013 15:19 — forked from plentz/nginx.conf
#don't send the nginx version number in error pages and Server header
server_tokens off;
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri