Skip to content

Instantly share code, notes, and snippets.

View coderofsalvation's full-sized avatar

Coder of Salvation / Leon van Kammen coderofsalvation

View GitHub Profile
@coderofsalvation
coderofsalvation / notifyvikingbot.py
Created August 8, 2012 14:11
Doorway/bridge between rounduptracker and php IRCBOT 'vikingbot' (or other IPC-supporting process)
# Copyright (c) 2012 Coder of Salvation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@coderofsalvation
coderofsalvation / csv2html
Created September 26, 2012 09:56
converts a csv to a nicely designed html file, great for generating reports using cron
#!/bin/bash
# Copyright (c) 2012 Coder of Salvation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@coderofsalvation
coderofsalvation / nbrowser
Created November 12, 2012 13:15
minimalistic bashfilebrowser which enables 4-button navigation. Highly customizable/configurable for all needs.
#!/bin/bash
#
# minimalistic filebrowser script which enables 4-button navigation.
#
# Why: I needed a simple way to navigate thru files using simple keyboardbindings.
#
# Usage:
# nbrowser next dir
# nbrowser next file
# nbrowser prev dir
@coderofsalvation
coderofsalvation / comicize
Created December 11, 2012 20:20
comicize scanned handdrawings into curvy vectordrawings (for simple webcomics and such)
#!/bin/bash
[[ ! -n "$1" ]] && echo "usage: $0 <image> <outimage> <title> <thickness=200> <whiteoffset=20> <tracetreshold=15> <curvetreshold=4> <zoom=2>" && exit 1
file="$1"
outfile="$2"
title="$3"
thickness="$4"
whiteoffset="$5"
tracetreshold="$6"
curvetreshold="$7"
@coderofsalvation
coderofsalvation / RESTdoc
Last active June 7, 2022 01:43
Quickndirty bash-utility to generate REST-documentation from sourcecode comments into css-styles html (or plainhtml). Can be handy for inclusion into phpdoc/phpdoctor/doxygen-dochains, instead of using heavyweight alternatives.
#!/bin/bash
#
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments.
# (initially aimed at php-files, but js should also work)
# Basically its a c-style comment -> markdown -> html converter
# Dependancies:
# - awk
# - sed
# - bash
# - php
@coderofsalvation
coderofsalvation / savihost
Last active February 26, 2018 00:15
savihostbash - a shellscriptwrapper to easily run windows vsts in linux without the usual dependancies like vstserver,dssi-vsthost etc..this only requires wine + savihost.exe. It enables you to easily run your plugins from the commandline, or integrate it into your desktop using icons/menu/filebrowser.
#!/bin/bash
trim(){
cat - | sed -e 's/^ *//g' -e 's/ *$//g' -e "s/'//g"
}
file="$(echo "$1" | trim)"
set -- "$file" # strip single quotes (PCFMAN)
path="$(dirname "$(readlink -f "$1")" )"
exepath=~/bin # /tmp
@coderofsalvation
coderofsalvation / imapmunch
Last active December 11, 2015 12:58
imapmunch easily searches/selects emails from imapserver, using filters, scans hashtags, prices and so on. Downloads attachements to certain folders. Outputs to csv, json and xml so it easily integrates with your shell(scripts). Personally I wrote this so I can scan bills with my smartphone, email them to myself (with a price and description in …
#!/usr/bin/env php
<?php
/**
* File: imapmunch
* Date: Fri 18 Jan 2013 05:30:45 PM CET
*
* easily searches/selects emails from imapserver, using filters, scans hashtags, prices and so on
*
* Usage: imapmunch [filteroptions] [--output=json|xml|csv]
*
@coderofsalvation
coderofsalvation / getCSVColumn
Created July 31, 2013 09:26
Simple way of using csv files as dataformat in bashscripts.
# example usage: cat foo.csv | while read line; do getCSVColumn "$line" 2; done
getCSVColumn(){
echo "$1" | sed 's/,,,/###/g' | sed 's/,,/##/g' | sed 's/,/#/g' | cut -f$2 -d"#" | sed 's/"//g'
}
@coderofsalvation
coderofsalvation / getJSON
Created July 31, 2013 09:59
Simple way to get JSON variables in bash using PHP. Works on probably on all webservers (with php installed)
#!/bin/bash
#
# example usage : xpath /tmp/test.json "foo->flop"
# example output: XML Developer's Guide
#
# given that /tmp/test.json looks like:
# { "foo": { "flop": "bar" } }
phpcode_jsonget='
$parts = str_replace( array("'"'"'","]"), "", $argv[2] );
@coderofsalvation
coderofsalvation / notify-irc-irssi
Last active December 22, 2015 18:09
generates notifications on your desktop (ubuntu/Gnu Linux X environment) when something happens in a channel on irssi (on another server) using ssh.
#!/bin/bash
#
# will show local notifications when something happens on IRC (using irssi)
#
# Usage:
#
# 1) make sure you have passwordless access to the server where irsii is running
# (hint: ssh-keygen & ssh-copy-id)
# 2) type in irssi: /set autolog on
# 3) look in ~/irclogs which channel you want to log (on the server running irssi)