Skip to content

Instantly share code, notes, and snippets.

View mkaito's full-sized avatar

Christian Höppner mkaito

View GitHub Profile
! --- special colors ---
*background: #120d0a
*foreground: #b9b4b2
! --- standard colors ---
! black
*color0: #120d0a
def test
puts "foo"
end
@mkaito
mkaito / tinysong.rb
Created June 29, 2011 00:33
Script that reads currently playing song from MPD via MPC and queries Tinysong for a sharing URL, then spits out a nicely formated text for you to tweet.
# coding: utf-8
require 'net/http'
require 'json'
require 'cgi'
require 'extlib'
playing = `mpc current`.chomp
key = "insert your API key here"
url = "http://tinysong.com/b/#{CGI.escape(playing)}?format=json&key=#{key}"
@mkaito
mkaito / jekyllator.sh
Created October 31, 2011 22:12
Jekyll glue script
#!/bin/zsh
BLOG_PATH=${HOME}/dev/blog;
DRAFTS_PATH=${BLOG_PATH}/_drafts;
POSTS_PATH=${BLOG_PATH}/_posts;
FILE_EXT=".mkd"
# "be" is a shell alias for "bundle execute". Replace for your way to get jekyll serving.
JEKYLL_EX="cd ${BLOG_PATH} && be jekyll";
JEKYLL_SERVE="${JEKYLL_EX} --auto --server 8080 && ${BROWSER} http://localhost:8080";
@mkaito
mkaito / jekyllator1.sh
Created October 31, 2011 22:44
Jekyllator blog post snippets
function slugify() {
[[ -z "$1" ]] && return 65;
s=`echo $1 | sed -e 's/\s\{1,\}/ /g' | sed 's/^[ \t]*//;s/[ \t]*$//g' | sed 's/ /-/g' | tr '[A-Z]' '[a-z]'`;
debug "1: $s";
typeset -A accents; # key value key value...
accents=( 'á' 'a' 'à' 'a' 'â' 'a' 'ä' 'a' 'ã' 'a'
'é' 'e' 'è' 'e' 'ê' 'e' 'ë' 'e'
'í' 'i' 'ì' 'i' 'î' 'i' 'ï' 'i'
'ó' 'o' 'ò' 'o' 'ô' 'o' 'ö' 'o' 'õ' 'o'
@mkaito
mkaito / readrc.sh
Created February 22, 2012 15:48
rc-file reading in a shell script
#!/usr/bin/env zsh
# An example script that reads a colon separated rc file, given on argv
# Line format expected:
# option: value
# Mind the colon and space separating option name from the value.
# Adjust the parameter expansion as needed if you change the line format.
# - read <var> will read a line at a time.
# - Piping the file name into the while block reads the file into the read call.
# - typeset -A <var> explicitly marks a hash for ZSH.
@mkaito
mkaito / post-receive
Created July 27, 2012 02:49
post-receive hook to notify our hubot instance
#!/usr/bin/env ruby
# Notify hubot when someone pushes.
require 'net/http'
branches = []
cnum = 0
STDIN.each do |line|
(oldref, newref, refname) = line.split
branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp
@mkaito
mkaito / memoricide-codefest.md
Created August 25, 2012 16:16 — forked from manpages/memoricide-codefest.md
Memoricide /codefest/ workflow

Workflow for memoricide /codefest/ project

  • Our work flow is based on features and projects. Each project has a maintainer, usually, the same person as the project author. The maintainer accepts new features and is makes decissions about feature APIs.

  • A feature request is assigned to a programmer.

  • He or she negotiates the JSON API with the project maintainer.

@mkaito
mkaito / screencast.sh
Created November 10, 2012 20:21
Recording a screencast with ffmpeg
ffmpeg -v info\
-f x11grab -s 1920x1064 -i :0.0+0,16\
-f pulse -i "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"\
-f pulse -i "alsa_input.usb-Sennheiser_Communication_Sennheiser_USB_headset-00-headset.analog-mono"\
-vcodec libx264 -preset ultrafast -tune zerolatency -crf 0\
-acodec pcm_s16le\
-filter_complex 'amerge, pan=2:c0=0.3*c0+3*c2:c1=0.3*c1+3*c2'\
"$rec"
@mkaito
mkaito / termite.strace.log
Created May 8, 2013 14:19
Strace output for termite
execve("/usr/bin/termite", ["termite"], [/* 89 vars */]) = 0
brk(0) = 0x12af000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=166383, ...}) = 0
mmap(NULL, 166383, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f30e5332000
close(4) = 0
open("/usr/lib/libvte2_90.so.9", O_RDONLY|O_CLOEXEC) = 4
read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2607\1\0\0\0\0\0"..., 832) = 832
fstat(4, {st_mode=S_IFREG|0755, st_size=662024, ...}) = 0