Skip to content

Instantly share code, notes, and snippets.

View markusfisch's full-sized avatar

Markus Fisch markusfisch

View GitHub Profile
@markusfisch
markusfisch / tweet.sh
Last active March 25, 2016 10:54
Shell script to tweet from the command line. Breaks longer messages into multiple tweets. Requires curl.
#!/usr/bin/env bash
# Post a tweet
#
# @param ... - tweet
tweet()
{
# Make a SSL request
#
# @param ... - request arguments
@markusfisch
markusfisch / README.md
Created September 24, 2016 19:14
Convert Wavefront OBJ to JavaScript arrays

Convert Wavefront OBJ to JavaScript arrays

Naive bash script to convert a Wavefront OBJ (as created by Blender) into JavaScript arrays:

$ ./obj2js < model.obj > model.js

Will print something like:

@markusfisch
markusfisch / keybase.md
Created November 4, 2016 10:04
keybase.md

Keybase proof

I hereby claim:

  • I am markusfisch on github.
  • I am markusfisch (https://keybase.io/markusfisch) on keybase.
  • I have a public key whose fingerprint is C87D EB20 EEF3 E854 BCEB 9883 32D7 D983 E2F0 EBD2

To claim this, I am signing this object:

@markusfisch
markusfisch / .piedockrc
Last active November 21, 2016 09:54
PieDock resource configuration for Ubuntu
size 320
fitts 1
title 1
font Sans 8.0
compositing 1
ignore-mask Num_Lock
@markusfisch
markusfisch / center.sh
Last active January 20, 2017 14:16
Center input from stdin in terminal or return 1 if it doesn't fit
#!/usr/bin/env bash
# Print n blank lines
#
# @param 1 - number of blank lines to print (default 1)
blanks() {
local I
for (( I=${1:-1}; I--; ))
do
echo
@markusfisch
markusfisch / README.md
Last active May 2, 2017 08:29
bash script to create new projects from project skeletons

Skeletons

Create new projects from project skeletons.

This script is for you if you create nontrivial projects that can be derived from a common base.

Sample

@markusfisch
markusfisch / emojize-swift.sh
Last active December 16, 2017 16:41
Replace that boring variable names with funny emojis in your Swift code
#!/usr/bin/env bash
# Replace that boring variable names with funny emojis in your Swift code
#
# @param 1 - file to emojize
emojize() {
local FILE=$1
local EMOJI=(😀 😬 😁 😂 😃 😄 😅 😆 😇 😉 😊 🙂 🙃 😋 😌 😍 😘 😗 😙 😚 😜 😝 😛 🤑 🤓 😎 🤗 😏 😶 😐 😑 😒 🙄 🤔 😳 😞 😟 😠 😡 😔 😕 🙁 😣 😖 😫 😩 😤 😮 😱 😨 😰 😯 😦 😧 😢 😥 😪 😓 😭 😵 😲 🤐 😷 🤒 🤕 😴 💤 💩 😈 👿 👹 👺 💀 👻 👽 🤖 😺 😸 😹 😻 😼 😽 🙀 😿 😾 🙌 👏 👋 👍 👊 👌 💪 🙏 👆 👇 👈 👉 🖕 🤘 🖖 💅 👄 👅 👂 👃 👁 👀 👤 🗣 👶 👦 👧 👨 👩 👱 👴 👵 👲 👳 👮 👷 💂 🕵 🎅 👼 👸 👰 🚶 🏃 💃 👯 👫 👬 👭 🙇 💁 🙅 🙆 🙋 🙎 🙍 💇 💆 💑 💏 👪)
local EMOJI_LEN=${#EMOJI[@]}
local I=0
@markusfisch
markusfisch / avup.sh
Last active June 29, 2019 00:44
Add, commit, tag and push in one go
#!/usr/bin/env bash
# Add, commit, tag and push
tag_and_push()
{
# find version (x.x.x) in uncommitted changes
local VERSION=''
VERSION=$(git diff -U0 |
grep -E "^\+.*([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})")
@markusfisch
markusfisch / SystemBarMetrics.java
Created January 14, 2017 14:37
Get the size of the status, tool and navigation bar on Android
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Build;
import android.util.TypedValue;
public class SystemBarMetrics {
public static int getStatusBarHeight(Resources res) {
return getIdentifierDimen(res, "status_bar_height");
@markusfisch
markusfisch / README.md
Last active June 29, 2019 00:46
Synchronize just the contents of a repository with a local directory

Manually embed sub repositories

Synchronize (the contents of) a repository with a local directory. Can be used to manually update "embedded" repositories (aka subtree's).

Does not touch the host repository's stage or history. You have to add and commit the changed files manually. Write a good commit message and have a clean history.