Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / qtfaststart.BAT
Created September 15, 2015 02:35
BAT script for running python qtfaststart on the current directory
@echo off
echo Preparing video for Fast Start...
IF EXIST "Output" (
echo Output directory is present
) else (
echo Writing Output directory
mkdir "Output"
)
@ianchen06
ianchen06 / locate.md
Last active September 16, 2015 10:36
Custom mlocate(locate) database for locate searching

You can use the -U option (--database-root PATH)

updatedb -l 0 -U /home/user/music -o /home/user/databasefile

-o writes to the output file

-l 0 makes that you can read it, otherwise it is only accessible for locate

Then you can then use it like:

@ianchen06
ianchen06 / limit-tc.sh
Last active September 22, 2018 07:02
TC limiting
#!/bin/bash
# Full path to tc binary
TC=$(which tc)
#
# NETWORK CONFIGURATION
# interface - name of your interface device
# interface_speed - speed in mbit of your $interface
# ip - IP address of your server, change this if you don't want to use
@ianchen06
ianchen06 / Readme.md
Created October 23, 2015 01:50 — forked from makevoid/Readme.md
use Mechanize persisting the cookie jar

EptiMecha

example on how to use mechanize with cookie jars, basically:

agent.cookie_jar.save_as "cookies.yml"
agent.cookie_jar.load "cookies.yml"

to try it:

  • download this zip
@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
########################################
#
# Nginx 1.8.0
# Pagespeed v.1.9.32.6
# OpenSSL 1.0.2d
# - Tested on Ubuntu 14.4.2
#
########################################
@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