Skip to content

Instantly share code, notes, and snippets.

View gizmomogwai's full-sized avatar

Christian Köstlin gizmomogwai

View GitHub Profile
@gizmomogwai
gizmomogwai / .gitignore
Created July 1, 2023 18:39 — forked from CyberShadow/.gitignore
nntp-md-adder
/nntp-md-adder
intellij-community
.DS_Store
*.png
@gizmomogwai
gizmomogwai / kitchen.plantuml
Last active April 14, 2018 13:57
The Kitchen, dish, dishwasher algorithm
@startuml
start
note right: Agent enters the kitchen to bring back a dish (e.g. glass, cup, mug, plate, ...)
if (Dishwasher running?) then (yes)
:Put dish into sink;
stop
else (no)
if (Dishwasher full?) then (yes)
if (Dishes in dishwasher clean?) then (yes)
:Put clean dishes back;
@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 / copy-lp-user.fish
Created December 2, 2016 09:43
fish function to copy lastpass username to the clipboard
function copy-lp-name -d "copy lp name"
if lpass ls | fzf > /tmp/fzf.result
set lp_account (cat /tmp/fzf.result | cut -d ' ' -f 1)
set lp_username (lpass show $lp_account | grep 'Username:' | cut -d ' ' -f 2)
echo -n $lp_username | copy
end
end
@gizmomogwai
gizmomogwai / copy-lp-pass.fish
Last active December 2, 2016 09:42
fish function to copy a lastpass password to the clipboard
function copy-lp-pass -d "copy lp pass"
if lpass ls | fzf > /tmp/fzf.result
set lp_account (cat /tmp/fzf.result | cut -d ' ' -f 1)
set lp_pass (lpass show $lp_account | grep 'Password:' | cut -d ' ' -f 2)
echo -n $lp_pass | copy
end
end
@gizmomogwai
gizmomogwai / copy.fish
Created December 2, 2016 09:39
fish function for copy to clipboard
function copy -d 'copy to clipboard'
switch (uname)
case Linux
xsel --clipboard --input
case Darwin
pbcopy
case '*'
echo "copy not supported for (uname)"
end
end
@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
@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
@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() {