Skip to content

Instantly share code, notes, and snippets.

View clauswitt's full-sized avatar

Claus Witt clauswitt

View GitHub Profile
(loop for line = (read-line *terminal-io* nil :eof)
until (eq line :eof)
do (write-line line))
(setq counter 0)
(loop for e in *args* collect
(progn
(setq counter (+ counter 1))
(write-line (concatenate 'string "argument #" (write-to-string counter) ": " e))
))
import { CanvasContext } from './CanvasContext';
import { Sprite } from './Sprite';
import { Sprites } from './GameSprites/Factory';
var context = new CanvasContext(document.getElementById('game'));
var sprites = [
new Sprite(100, 100,'assets/spritesheet.png', 24, 24, 0, 376, 16),
@clauswitt
clauswitt / split.cpp
Created July 22, 2015 11:40
Split a string with boost
#include <iostream>
#include <string>
#include <vector>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
int main() {
std::string result;
std::string str01 = "this,is,a,list,of,words";
@clauswitt
clauswitt / trim.cpp
Created July 22, 2015 11:30
Trim a string with boost
#include <iostream>
#include <string>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/trim_all.hpp>
int main() {
std::string result;
std::string str01 = " this is a string with something to trim ";
(evil-leader/set-key "oo" 'open-org-dir)
(evil-leader/set-key "oa" 'my-org-archive-done-tasks)
(evil-leader/set-key "og" 'gtd)
(evil-leader/set-key "oj" 'journal)
(evil-leader/set-key "ot" 'org-capture)
(evil-leader/set-key "on" 'notes)
(evil-leader/set-key "oG" 'groceries)
(evil-leader/set-key "oi" 'gtd-inbox)
(evil-leader/set-key "oI" 'gtd-inbox-txt)
(evil-leader/set-key "oU" 'org-mobile-push)
(defun open-org-dir ()
"Opens the org dir"
(interactive)
(find-file "~/Dropbox/org/")
)
(defun gtd-inbox ()
"Open the gtd inbox"
(interactive)
(find-file "~/Dropbox/org/inbox.org")
)
@clauswitt
clauswitt / catclone.c
Created January 2, 2015 09:47
A simple (dumbed down) cat clone
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
FILE *read_this;
if (isatty(fileno(stdin))) {
if(argc > 1) {
printf("filename: %s\n", argv[1]);
read_this = fopen(argv[1], "r");
@clauswitt
clauswitt / f.sh
Last active August 29, 2015 14:04
sox convert files from aif to wav (with a filename change as well) recursively from current dir
#!/bin/zsh
OLDIFS=$IFS
IFS=$'\n'
for file in `find . -name '[0-9]*_[0-9a-z]*aif'`; do
dir=`dirname "$file"`
base=`basename "$file"`
wav_base=`echo "$base" | cut -d '-' -f1`
sox "$file" $dir/$wav_base.wav
done
IFS=$OLDIFS
@clauswitt
clauswitt / pumpdenfunkbot.coffee
Created May 23, 2014 10:01
Pump Den Funk Bot
# Description:
# Pump den funk
#
# Dependencies:
# None
#
# Configuration:
#
#
# Commands: