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
# Convert `mymovie.mp4` to `mymovie.mov`, re-encoding. | |
ffmpeg -i mymovie.mp4 mymovie.mov | |
# Change `mymovie.mov` to `mymovie.mp4`, without re-encoding. | |
ffmpeg -i mymovie.mov -vcodec copy -acodec copy mymovie.mp4 | |
# Change `mymovie.mp4` to `mymovie-nosound.mp4`, dropping audio and re-encoding video to H.264 high quality | |
ffmpeg -i mymovie.mp4 -c:v libx264 -profile:v high -an mymovie-nosound.mp4 | |
# Resize `mymovie.mp4` to `mymovie-480.mp4`, setting width to 480px and keeping aspect ratio |
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
" JavaScript formatting. | |
" Install https://github.com/rdio/jsfmt - npm install -g jsfmt | |
function! Jsformat() | |
let regel=line(".") | |
%!jsfmt --format=true | |
call cursor(regel, 1) | |
endfunction | |
autocmd BufRead,BufNewFile *.js setfiletype javascript | |
autocmd Filetype javascript command! Fmt call Jsformat() |
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
var queryparams = (window.location.href.split("?")[1] || "") | |
.split("&") | |
.map(function(param) { | |
return param.split("=") | |
.map(function(part) { return decodeURIComponent(part); }); | |
}) | |
.reduceRight(function(prev, curr) { | |
if (curr.length == 2) { prev[curr[0]] = curr[1]; } | |
return prev; | |
},{}); |
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
Array.prototype.forEach.call(document.querySelectorAll('textarea'), function(el) { el.setAttribute('style', 'resize: vertical');}); |
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
{ | |
"manifest_version": 2, | |
"name": "crx-widgetsjs", | |
"description": "Load Twitter's widgets.js in a Chrome extension", | |
"version": "1.0", | |
"permissions": [ | |
], | |
"browser_action": { |
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
require 'net/https' | |
# Returns {"errors":[{"message":"Bad Authentication data","code":215}]} | |
# Issues a HTTPS request to: GET https://api.twitter.com/1.1/users/show.json?user_id=33978 | |
# Prints: Explicit SSL: #<Net::HTTPBadRequest:0x10b65f188> | |
uri = URI.parse("https://api.twitter.com/1.1/users/show.json?user_id=33978") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
request = Net::HTTP::Get.new(uri.request_uri) |
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
document.body.appendChild(function() { var e = document.createElement("input"); e.type="time"; e.style.position="absolute"; e.style.top="0px"; e.style.left="0px"; e.style.zIndex="1000"; return 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
// I couldn't have come up with this sober / well rested | |
const ( | |
FACING_LEFT = 1 << iota | |
FACING_RIGHT = 1 << iota | |
PLAYER_STOPPED = 1 << iota | |
PLAYER_WALKING = 1 << iota | |
PLAYER_JUMPING = 1 << iota | |
) | |
a := map[int]*Animation{ |
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
package main | |
import "fmt" | |
func main() { | |
foo := 4 | 2 | 16 | |
foo &= (511 ^ 4) | |
fmt.Printf("%b", foo) | |
} |
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
#!/bin/bash | |
# From http://en.wikipedia.org/wiki/Netcat | |
# Proxy HTTPS requests through http://localhost:8080 | |
# That way, Wireshark can sniff the traffic. | |
# Example usage: | |
# ./proxy.sh www.twitter.com | |
mkfifo tmp | |
mkfifo tmp2 | |
nc -k -l 8080 > tmp < tmp2 & |