Skip to content

Instantly share code, notes, and snippets.

View markusfisch's full-sized avatar

Markus Fisch markusfisch

View GitHub Profile
@markusfisch
markusfisch / base64.sh
Last active January 20, 2022 21:39
base64 fallback implementation in bash
#!/bin/bash
# Fallback base64 en-/decoder for systems that lack a native implementation
#
# @param ... - flags
which base64 &>/dev/null || {
# if even od is missing
which od &>/dev/null || od()
{
local C O=0 W=16
@markusfisch
markusfisch / mime.sh
Last active March 24, 2023 16:22
bash functions to dump and inspect a message in MIME format
#!/usr/bin/env bash
##############################################################################
#### MIME interface
##############################################################################
# Parse message in MIME format and create a temporary cache directory
mime_parse()
{
MIME_CACHE=${MIME_CACHE:-`mktemp -d ${BIN}.XXXXXXXXXX`}
@markusfisch
markusfisch / DemoBubblesView.java
Last active February 21, 2023 19:58
Draw text in a given rectangle and automatically wrap lines on a Android Canvas
package de.markusfisch.android.textrect.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;
import de.markusfisch.android.textrect.graphics.TextRect;
@markusfisch
markusfisch / ImageViewer.js
Last active June 29, 2019 00:59
A small and simple hovering image viewer
/**
* A small and simple hovering image viewer
*
* @param loadingHtml - HTML snippet to show while loading (optional)
*/
function ImageViewer( loadingText )
{
/** Text to show while loading */
this.loadingText = loadingText ?
loadingText :
@markusfisch
markusfisch / fnmod.sh
Last active June 29, 2019 00:58
Remove blanks, convert hypens and underscores and fix extensions in file/directory names
#!/usr/bin/env bash
# Remove blanks
remove_blanks()
{
[[ $N == *[' ']* ]] || return
mv_to "$P/${N// /}"
}
# Convert hypens to underscores
@markusfisch
markusfisch / gist:3136580
Created July 18, 2012 14:40
Pan and zoom/pinch images with MOAI
------------------------------------------------------------------------------
-- local members
------------------------------------------------------------------------------
local devWidth, devHeight = 0, 0
local viewport = nil
local layer = nil
local quad = nil
local prop = nil
local imgWidth, imgHeight = 0, 0
@markusfisch
markusfisch / README.md
Created August 5, 2012 18:10
Configure vim and xterm to look and behave like GVim

Configure vim and xterm to look and behave like GVim

If you like to have an extra window for editing files with vim, you may either install/use GVim or you can simply make vim run inside xterm.

Setup

You'll need (at least) VIM 7.3 and XTerm 276.

@markusfisch
markusfisch / gist:3864786
Created October 10, 2012 11:00
Make BSD/OSX find/cp/mv behave like the GNU/Linux tools
# Simply put that into your ~/.profile or ~/.bash_aliases
# Auto-complete BSD/OSX find to behave like GNU find
#
# @param ... - find params
find --version &>/dev/null || find()
{
local P=
[ -d "$1" ] || P=.
command find $P "$@"
@markusfisch
markusfisch / README.md
Last active January 21, 2023 15:15
Handy shell script that eases building and running Android apps from the command line with ant and adb

Handy Android shortcuts

This little script eases building, running, testing and analyzing Android apps with [ant][2] and [adb][1].

You may also see it as interactive dictionary of useful [adb commands][1].

How to use

@markusfisch
markusfisch / what-works-for-me.md
Last active June 29, 2019 00:56
What coding style works for me

What works for me

This is a reflection of my coding style. What I have found to work for me.

As everything in this universe, nothing is final. Change is an inherent property of this world. And there are many equally good ways to get to Rome.