Skip to content

Instantly share code, notes, and snippets.

View gizmomogwai's full-sized avatar

Christian Köstlin gizmomogwai

View GitHub Profile
@gizmomogwai
gizmomogwai / parser.d
Created December 10, 2010 16:50
a shot at combinator parsing for d
module pc.parser;
import std.stdio;
import std.array;
import std.ctype;
import std.string;
import std.conv;
import std.regex;
import std.variant;
import std.functional;
@gizmomogwai
gizmomogwai / gist:987837
Created May 23, 2011 23:18
gs-core with os x
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>org/graphstream/stream/file/FileSinkSWF.java</exclude>
</excludes>
<compilerId>eclipse</compilerId>
</configuration>
@gizmomogwai
gizmomogwai / gist:1014032
Created June 8, 2011 08:27
measurement of progresslistener
require 'benchmark'
class ProgressListener
def initialize
s = Benchmark.bm do |x|
x.report('ProgressListener.initialize') do
@todo = 0.0
@needed_tasks = {}
Rake::application.top_level_tasks.each do |name|
tasks = find_tasks_for_toplevel_task(name)
tasks.each do |t|
@gizmomogwai
gizmomogwai / structs_vs_classes.d
Created September 26, 2011 18:13
calloverhead of methods of structs and classes
import std.datetime;
import std.stdio : writeln;
struct HStruct {
size_t c;
void add() {
c = c % 3 +1;
}
size_t get() {
@gizmomogwai
gizmomogwai / clone_vmware_image.rb
Created May 3, 2013 15:13
Clone a stopped VMWare vm.
from = ARGV[0]
to = ARGV[1]
puts "copy from #{from} to #{to}"
def run(cmd)
puts "Executing #{cmd}"
if !system(cmd)
raise "error while executing #{cmd}"
end
end
#!/bin/sh
repo forall -c 'if git status 2> /dev/null | grep -E "modified|deleted|Untracked|Changes"; then pwd; sleep 3;tig status; fi'
@gizmomogwai
gizmomogwai / rt.fish
Created August 17, 2015 19:40
select one raketask with fzf in the fish shell
function rt -d "select one rake task"
if rake -T | fzf > $TMPDIR/fzf.result
set fzf_result (cat $TMPDIR/fzf.result | cut -d ' ' -f 2)
set h "rake $fzf_result"
commandline $h
end
end
@gizmomogwai
gizmomogwai / rt.bash
Created August 17, 2015 19:54
execute one rake task for bash
#!/bin/bash
function rt() {
local task
task=$(rake -T | fzf | cut -d ' ' -f 2)
rake $task
}
@gizmomogwai
gizmomogwai / cloud-config.yaml
Created August 17, 2015 21:48
simple cloud config file
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAs5zpVBQD4paP5RVkb6LGsjGjQXANP0S7SUxXkTY4+3Muov651wzcX/VmDHBQFLSmT92PdqSXL2+8HiAvlPxaHohZIsIu7JEOO5yvAeb/y/rw5Gp1ggVieVojLLbhhnZ5ECTR4Wj7/TvQI7IaL0WH8KHzo8Q+nBz1ZzLkIDTjGAfcgwxZ32ieGAea5rDjFouxmIZTisMIdroAZT0M/QvM1GgbXmHaairYLsJJDE1CUI5GjHGLFbCE10qRlXqHMyw6GKkoXiV4LzvnIcQ1J0l7GIWq6vnvy2NWkMBckA/DLnL123Z95676KwIHlzDw11LPzXv1ncwf5lOOWRuLa+OWcw== gizmo@armadillo
@gizmomogwai
gizmomogwai / up.fish
Created May 31, 2016 21:44
fish function to combine lpass with fzf and pbcopy
function up -d "lastpass user and password"
if lpass ls | fzf > /tmp/fzf.result
cat /tmp/fzf.result
set account_name (cat /tmp/fzf.result | cut -f 1 -d ' ')
lpass show --username $account_name | pbcopy
read -p 'echo username stored in clipboard ... press return to continue'
lpass show --password $account_name | pbcopy
read -p 'echo password stored in clipboard ... press return to continue'
end
end