Skip to content

Instantly share code, notes, and snippets.

@kersny
kersny / .i3status.conf
Created August 23, 2013 00:20
Some random system config stuff
general {
colors = true
interval = 5
output_format = "i3bar"
}
order += "ethernet eth0"
order += "load"
order += "time"
@kersny
kersny / gist:6181329
Created August 8, 2013 03:58
base64 png of my profile pic
data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTAK/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAUABQAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A7R9A1iLmWyk2458sA/oC2aqnSp4utpdRnvuhIB/SuX/bn8Q+Jfh7Y+D7zw5rF3pDTzXMUxtXKCTAjK7h0OPm/M15Lo
set-option -g prefix C-a
# tmux vim integration
# http://robots.thoughtbot.com/post/53022241323/seamlessly-navigate-vim-and-tmux-splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
@kersny
kersny / .tmux.conf
Created March 8, 2013 19:52
My tmux conf
set-option -g prefix C-a
#use "v" and "s" to do vertical/horizontal splits, like vim
bind s split-window -v
bind v split-window -h
# use the vim motion keys to move between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
@kersny
kersny / display.sh
Created February 27, 2012 18:45
reload pdf in Skim on compile
#!/bin/bash
# the first argument should be the tex file, either with or without extension
file="$1"
# run pdflatex and bibtex, and open or reload the pdf in Skim
#pdflatex "${file}" && bibtex "${file}" && pdflatex "${file}" && pdflatex "${file}" && \
/usr/bin/osascript \
-e "set theFile to POSIX file \"${file}\" as alias" \
-e "set thePath to POSIX path of theFile" \
@kersny
kersny / lambda.coffee
Created December 14, 2011 03:26
http://experthuman.com/programming-with-nothing in CoffeeScript (my first CS code)
INCREMENT = (n) -> (p) -> (x) -> p(n(p)(x))
DECREMENT = (n) -> (f) -> (x) -> n((g) -> (h) -> h(g(f)))((y) -> x)((y) -> y)
ADD = (m) -> (n) -> n(INCREMENT)(m)
SUBTRACT = (m) -> (n) -> n(DECREMENT)(m)
MULTIPLY = (m) -> (n) -> n(ADD(m))(ZERO)
POW = (m) -> (n) -> n(MULTIPLY(m))(ONE)
ZERO = (f) -> (x) -> x
ONE = (f) -> (x) -> f(x)
@kersny
kersny / gist:1429038
Created December 4, 2011 03:25
v4l2 async demo code
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
* From http://v4l2spec.bytesex.org/spec/capture-example.html
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@kersny
kersny / gist:1261713
Created October 4, 2011 13:58
Getting UV Sizes
#include "libuv/deps/libuv/include/uv.h"
#include <stdio.h>
int main()
{
printf("Prepare Watcher: %lu\n", sizeof(uv_prepare_t));
printf("Idle Watcher: %lu\n", sizeof(uv_idle_t));
printf("Check Watcher: %lu\n", sizeof(uv_check_t));
printf("Timer Watcher: %lu\n", sizeof(uv_timer_t));
printf("TCP Type: %lu\n", sizeof(uv_tcp_t));
@kersny
kersny / PrepareWatcher.cs
Created August 3, 2011 22:57
Libuv bindings with static callbacks, no extra c layer, and magic numbers!
// Compile on Mac with Mono as 'dmcs PrepareWatcher.cs'
// With a libuv clone, after 'make', do:
// ar -x uv.a
// gcc -o libuv.dylib -dynamiclib -m32 *.o -framework CoreServices
// rm __.SYMDEF\ SORTED *.o
//
// Then run with 'mono PrepareWatcher.exe'
using System;
using System.Runtime.InteropServices;
@kersny
kersny / websockets_fix.patch
Created June 23, 2011 17:58
Manos Patch for Websockets
diff --git a/src/Manos/Manos.Http/HttpEntity.cs b/src/Manos/Manos.Http/HttpEntity.cs
index 5230efe..8f35b52 100644
--- a/src/Manos/Manos.Http/HttpEntity.cs
+++ b/src/Manos/Manos.Http/HttpEntity.cs
@@ -64,6 +64,7 @@ namespace Manos.Http {
private IHttpBodyHandler body_handler;
private bool finished_reading;
+ private bool Upgraded;