Skip to content

Instantly share code, notes, and snippets.

Arne Roomann-Kurrik kurrik

Block or report user

Report or block kurrik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kurrik
kurrik / GoogleForms-CustomDestination.gs
Last active Apr 2, 2019
Sending nicely-formatted change emails from Google Apps Forms
View GoogleForms-CustomDestination.gs
/**
* This script sends an email in response to form submissions.
* It formats metadata specified in the form and may be configured
* to send to different audiences depending on which options are
* chosen. The email is nicely formatted, suitable for ingestion
* into Slack.
**/
/** CHANGE THE FOLLOWING TO MATCH YOUR FORM **/
@kurrik
kurrik / .tmux.conf
Last active Jun 29, 2019
Remote .tmux.conf (handles nesting, different colors)
View .tmux.conf
# Install:
# curl https://gist.githubusercontent.com/kurrik/ec0a83cf568b9c16b8ce08dd407adf65/raw/.tmux.conf > ~/.tmux.conf
#
# Instructions:
# When nested, use an extra `ctrl-b` to issue commands to the nested session.
# E.g. to go to the next window `ctrl-b ctrl-b ctrl-n`
# Colors
set -g default-terminal "xterm-256color"
@kurrik
kurrik / ffmpeg_convert.sh
Last active Jan 8, 2019
ffmpeg recipes
View ffmpeg_convert.sh
# 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
@kurrik
kurrik / .vimrc
Created May 10, 2014
Set up :Fmt command to autoformat JavaScript files in Vim
View .vimrc
" 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()
@kurrik
kurrik / queryparams.js
Created Apr 16, 2014
EC5 querystring parsing in the most obnoxiously functional way possible
View queryparams.js
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;
},{});
@kurrik
kurrik / paste.js
Last active Aug 29, 2015
Paste in Chrome addressbar and add "javascript:" to the front to enable resizing of textareas on the page
View paste.js
Array.prototype.forEach.call(document.querySelectorAll('textarea'), function(el) { el.setAttribute('style', 'resize: vertical');});
@kurrik
kurrik / manifest.json
Created Mar 31, 2014
Including embedded Tweets in a Google Chrome extension
View manifest.json
{
"manifest_version": 2,
"name": "crx-widgetsjs",
"description": "Load Twitter's widgets.js in a Chrome extension",
"version": "1.0",
"permissions": [
],
"browser_action": {
@kurrik
kurrik / twitter_ssl.rb
Created Mar 21, 2013
Demonstrating that Ruby sends invalid HTTPS requests unless use_ssl is explicitly set
View twitter_ssl.rb
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)
@kurrik
kurrik / input-time.js
Created Oct 8, 2012
Insert a time input into Twitter
View input-time.js
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; }())
@kurrik
kurrik / anim.go
Created Aug 27, 2012
My favorite code from this weekend
View anim.go
// 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{
You can’t perform that action at this time.