brew install go
export GOROOT="/usr/local/opt/go/libexec"
export GOPATH="$HOME/.go"
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hand_shutdown "key 290 mod1" | |
hand_capmouse "key 291 mod1" | |
hand_fullscr "key 13 mod2" | |
hand_pause "key 19 mod2" | |
hand_mapper "key 282 mod1" | |
hand_speedlock "key 293 mod2" | |
hand_recwave "key 287 mod1" | |
hand_caprawmidi "key 289 mod1 mod2" | |
hand_scrshot "key 286 mod1" | |
hand_video "key 286 mod1 mod2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! switch { | |
($($a:expr => $b:expr;)* _ => $e:expr $(,)?) => { | |
match () { | |
$(_ if $a => $b,)* | |
_ => $e, | |
} | |
}; | |
} | |
fn f1() -> bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 推荐做法: | |
static class Stop extends Thread { | |
static void init() { | |
Runtime.getRuntime().addShutdownHook(new Stop()); | |
} | |
@Override | |
public void run() { | |
Thread.currentThread().setName("stop"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source /usr/local/go/src/pkg/runtime/runtime-gdb.py | |
b main.main |
ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install Homebrew OS X package manager: | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
Install ffmpeg with x265 support: | |
brew install ffmpeg --with-fdk-aac --with-sdl2 --with-freetype --with-libass --with-libvorbis --with-libvpx --with-opus --with-x265 | |
Convert video to x265: | |
ffmpeg -i input -c:v libx265 -preset medium -crf 28 -c:a aac -b:a 128k output.mp4 | |
Uninstall ffmpeg: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainClass { | |
public static void main(String[] args){ | |
ClassLoader classLoader = MainClass.class.getClassLoader(); | |
try { | |
Class aClass = classLoader.loadClass("com.jenkov.MyClass"); | |
System.out.println("aClass.getName() = " + aClass.getName()); | |
} catch (ClassNotFoundException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
var img = new Image(); | |
img.src = 'img/img.png'; | |
img.onload = function () { | |
var canvas = document.createElement('canvas'), context = canvas.getContext('2d'); | |
canvas.width = img.width; | |
canvas.height = img.height; | |
context.drawImage(img, 0, 0, img.width, img.height); | |
console.log(canvas.toDataURL('image/png')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hard won knowledge from http://stackoverflow.com/questions/20035615/using-raw-image-data-from-ajax-request-for-data-uri | |
var xmlHTTP = xhr.XMLHttpRequest(); | |
xmlHTTP.open('GET', url, true); | |
xmlHTTP.responseType = 'arraybuffer'; | |
xmlHTTP.onload = function(e) { | |
var arr = new Uint8Array(this.response); | |
var raw = String.fromCharCode.apply(null,arr); | |
var b64 = base64.encode(raw); | |
var dataURL="data:image/png;base64," + b64; | |
}; |
NewerOlder