Skip to content

Instantly share code, notes, and snippets.

View objmagic's full-sized avatar

R Li objmagic

View GitHub Profile
@johnynek
johnynek / Future.rs
Created November 13, 2014 04:20
Future with map and monadic bind in Rust.
use std::comm::{Receiver, channel};
use std::io;
use std::mem::replace;
use std::task::spawn;
struct Future<'a, A> {
state: FutureState<'a, A>
}
(*
% WatLog test case: Insertion Sort
[lt-n: a, b].
[lt-n: b, c].
[lt-n: c, d].
[lt-n: d, e].
% transitive closure on lt-n relation
{([lt-n: #x, #y]) => [lt: #x, #y]}.
@tuoxie007
tuoxie007 / gist:10224417
Last active August 29, 2015 13:58
convert mkv to mp4 without reencoding
背景:一般的mkv,視頻用的是h264,音頻用的是AC3,蘋果都支持,但mkv這種封裝格式蘋果不支持。
此命令是一個事例,適用于一般的mkv,此處不做視頻和音頻重編碼,只修改封裝格式,同時還把外掛字幕一並打上。
只轉封裝不重編碼的好處是速度快,基本相當于硬盤拷貝。
轉碼前最好先ffmpeg -i a.mkv看一下視頻信息再看要怎樣轉碼,具體信息可參考ffmpeg.org官方文檔
ffmpeg -i a.mkv -i a.eng.srt -map 0:0 -map 0:1 -map 1:0 -vcodec copy -acodec copy -scodec mov_text -metadata:s:s:0 language=eng -y b.mp4
@avsm
avsm / source-install-libsodium.sh
Last active August 29, 2015 13:56
install libsodium from source
#!/bin/sh -ex
V=0.7.1
curl -OL https://download.libsodium.org/libsodium/releases/libsodium-${V}.tar.gz
tar -zxvf libsodium-${V}.tar.gz
cd libsodium-${V}
./configure
make
sudo make install
@lotem
lotem / rime_deployer
Created April 26, 2013 03:22
使用 Squirrel 自帶的命令行工具 rime_dict_manager 和 rime_deployer
#!/bin/bash
#
# put this script in ~/Library/Rime, then deploy Rime for Squirrel:
# ./rime_deployer --build . "/Library/Input Methods/Squirrel.app/SharedSupport/"
# see other supported options:
# ./rime_deployer
DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_deployer" $@
@magnetikonline
magnetikonline / README.md
Last active September 1, 2023 00:41
Bookmarklet to pretty print Gist pages without the usual page chrome, just content.

Pretty print bookmarklet helper for Gist pages

Create a new bookmark somewhere handy in your browser with the following URL:

javascript:var el=document.createElement('style');el.media='print';el.innerHTML='#header,.pagehead.repohead,.gist-description.container,.file-box .meta,#comments,.js-comment-form,#footer{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Please consider the environment before printing :)');
  • Navigate to your Gist of choice
  • Hit the bookmarklet