Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / image-proxy.conf
Created January 7, 2016 02:43 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@ianchen06
ianchen06 / add_root_ca.sh
Created February 4, 2016 11:04
Add custom Root CA to system file using OpenSSL
#!/bin/bash
# Replace <yourCA> with the filename
# The output will be in the same format as ones in ca-bundle.crt
openssl x509 -in <yourCA>.crt -text >> /usr/share/ssl/certs/ca-bundle.crt
@ianchen06
ianchen06 / encode.py
Created February 23, 2016 02:46 — forked from derekkwok/encode.py
Simple python script to encode videos using ffmpeg
"""
This python script encodes all files that have the extension mkv in the current
working directory.
Sources:
http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
"""
import subprocess, os
#-------------------------------------------------------------------------------
@ianchen06
ianchen06 / js_in_vim.md
Created February 25, 2016 23:51
set up Vim for javascript development

Works great in combination with yajs, really makes for a very good JS development experience in VIM. In combination with syntastic/eslint/eslint-plugin-react, neocomplete, tern_for_vim, and javascript-libraries-syntax.vim it get's pretty near to perfect for me.

https://github.com/gavocanov/vim-js-indent

@ianchen06
ianchen06 / build_nginx.md
Last active March 7, 2016 02:46
compiling-nginx-with-modules-pagespeed-and-geoip

#######Compiling nginx with pagespeed and GeoIP module

As root execute below commands

# yum install gcc-c++ pcre-devel pcre-devel zlib-devel make unzip openssl-devel

And then download PageSpeed with below commands

# mkdir -P /opt/nginx; mkdir -P /opt/nginx/modules/;
# cd /opt/nginx/modules
# NPS_VERSION=1.9.32.3
# wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
# unzip release-${NPS_VERSION}-beta.zip
@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.
@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

My test gist

  • multinomial naive bayes classifier example
@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: 從社交平台找需求,如果沒有點子的話。