Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / create_pg_replicate.sh
Created July 21, 2016 10:54
Postgresql 9.5 stream replication master slave
#install postgresql 9.5
#==========================================
sudo vim /etc/apt/sources.list.d/postgresql.list
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.5
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.5
@ianchen06
ianchen06 / Vagrantfile
Last active April 13, 2017 11:38
notes on setting up spark 1.6.1 cluster with vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define "worker1" do |worker|
worker.vm.hostname = "worker1"
worker.vm.network "private_network", ip: "192.168.34.10"
worker.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
@ianchen06
ianchen06 / Makefile
Created May 19, 2016 03:41 — forked from vdel26/Makefile
Makefile for working with a remote Nginx
#### SETTINGS
NGINXDIR = /usr/local/openresty/nginx/
NGXCONF = nginx_dummycustomer.conf
USER = ubuntu
REMOTE = ec2-54-224-138-186.compute-1.amazonaws.com
REMOTEDIR = /home/$(USER)/dummycustomer/
PRIVATEKEY = /Users/victordg/.ssh/aws/vdg-3scale.pem
####
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@ianchen06
ianchen06 / big_camp_day2.md
Created May 10, 2016 03:52
big camp day 2 how to be a good god

Big Camp Day 2

怎樣做好一個上帝

  • 上帝:做產品的人
  • 凡人:用產品的人

記得做好切換!

Q: 需求從哪裡找?A: 從社交平台找需求,如果沒有點子的話。

My test gist

  • multinomial naive bayes classifier example
@ianchen06
ianchen06 / ffmpeg-web-video-guide.md
Created April 26, 2016 09:20 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@ianchen06
ianchen06 / start_stream.sh
Created March 31, 2016 03:31
ffmpeg hls live stream creator
#!/bin/bash
ffmpeg -v verbose -f video4linux2 -vcodec mjpeg -s 640x480 -r 5 -i /dev/video0 -c:v libx264 -crf 18 -profile:v baseline -maxrate 400k -bufsize 1835k -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_list_size 6 -hls_wrap 10 -start_number 1 /var/www/live/mystream.m3u8
@ianchen06
ianchen06 / dash-avc264 command lines
Created March 28, 2016 10:12 — forked from ddennedy/dash-avc264 command lines
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.