Skip to content

Instantly share code, notes, and snippets.

View benkaiser's full-sized avatar
🌴
Loving Life

Benjamin Kaiser benkaiser

🌴
Loving Life
View GitHub Profile
@benkaiser
benkaiser / my_marble.py
Created December 29, 2013 18:22
Marble Python Hello World example
from PyQt4.QtGui import *
from PyKDE4.marble import *
import sys
def main():
# Initialize QApplication
app = QApplication(sys.argv)
# Create a Marble QWidget
m = Marble.MarbleWidget()
@benkaiser
benkaiser / xkcd.py
Last active November 26, 2015 10:35
#!/usr/bin/env python
# xkcd.py
#
# Copyright 2012 Benjamin Kaiser <benkaiser@benkaiser>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@benkaiser
benkaiser / config
Created February 5, 2014 11:59
Scripts to get i3 dynamic tagging working
# Just add the following lines to your i3 config file
# dynamic tagging feature
bindsym $mod+t exec ~/.i3/get_workspace_options.py | dmenu -b | ~/.i3/go_to_workspace.py
bindsym $mod+Shift+t exec ~/.i3/get_workspace_options.py | dmenu -b | ~/.i3/move_to_workspace.py
@benkaiser
benkaiser / .conkyrc
Last active November 20, 2016 20:54
My conkyrc file. Mainly defaults except for colors and my added xkcd title text viewer
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
@benkaiser
benkaiser / crontab
Created February 13, 2014 11:43
xkcd crontab
* * * * * DISPLAY=:0 /usr/bin/bash /home/benkaiser/.i3/update_background
@benkaiser
benkaiser / find.sh
Created February 17, 2014 00:58
Find all files in directory and sort them descending based on size
find -type f | xargs du --block-size=1K | sort -rn
@benkaiser
benkaiser / config.cson
Last active August 29, 2015 14:01
Atom Settings
'editor':
'fontSize': 16
'showInvisibles': true
'showIndentGuide': true
'invisibles':
'cr': 'EW! CR!'
'tab': 'TAB?'
'eol': ''
'core':
'themes': [
@benkaiser
benkaiser / app.js
Created May 29, 2014 07:28
Download youtube video, convert it to mp3 and tag it
var ffmpeg = require("fluent-ffmpeg");
var taglib = require("taglib");
var ytdl = require("ytdl");
var fs = require("fs");
var url = 'http://www.youtube.com/watch?v=gXK5YpoadCU';
var title = "";
var authot = "";
@benkaiser
benkaiser / reverse_pointer.c
Created August 13, 2014 13:44
Reverses a linked-list in O(n) time and O(1) space
#include "stdio.h"
#include <stdlib.h>
typedef struct Item Item;
struct Item {
int value;
Item* next;
};
@benkaiser
benkaiser / jumblesort.js
Created September 1, 2014 11:38
Funny sorting function I jokingly came up with last semester that sorts lists with order O(n^n^n).Seriously this is a joke, don't ever use it.
// sort the list in order O(n^n^n)
function jumblesort(list){
while(!sorted(list)){
list = shuffle(list);
}
return list;
}
function shuffle(list) {
for(var i = list.length - 1; i > 0; i--) {