Skip to content

Instantly share code, notes, and snippets.

View HeGanjie's full-sized avatar

Bruce He HeGanjie

View GitHub Profile
yellowled / ffmpeg-html5
Created December 6, 2011 19:39
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. Will probably convert this to a bash script later, but for the time being, here's some examples. Not sure there have actually sensible dimensions and bitrates for web video.
# webm
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm
# mp4
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4
# ogg (if you want to support older Firefox)
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend
kconragan /
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
buildscript {
repositories {
dependencies {
classpath ''
apply plugin: 'android'
willurd /
Last active May 25, 2024 13:16
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
oldrev / RmbUpperConverter.cs
Last active December 23, 2015 12:09
/** 中文互联网上迄今为止实现最正确、代码最漂亮且效率最高的大写人民币金额转换代码
* 作者:李维 <>
* 版权所有 (c) 2013 昆明维智众源企业管理咨询有限公司。保留所有权利。
* 本代码基于 BSD License 授权。
* */
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
tilmanschweitzer / intercept-function.js
Last active September 23, 2022 18:25
Function to intercept functions calls even to nativ functions.
function interceptFunction (object, fnName, options) {
var noop = function () {};
var fnToWrap = object[fnName];
var before = options.before || noop;
var after = options.after || noop;
object[fnName] = function () {
before.apply(this, arguments);
var result = fnToWrap.apply(this, arguments);
after.apply(this, arguments);
mediavrog /
Last active September 17, 2022 13:17
Android Compatibility popup menu with icons (requires support library v7)
* Seems like the only way to use it currently (as of 10/2018) is through reflection
* see
package com.vuzz.snapdish.ui;
import android.content.Context;
sr75 / wget-jdk-oracle-install-example.txt
Last active March 16, 2023 11:28
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"" \
-O jdk-7-linux-x64.rpm
# ubuntu
kjlubick / InstallingMeld
Last active November 2, 2023 02:49
How to install Meld on Windows and getting it set up with Git
After installing it
I had to tell git where it was:
git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld\meld.exe”
And that seems to work. Both merging and diffing with “git difftool” or “git mergetool”