Skip to content

Instantly share code, notes, and snippets.

@markusfisch
markusfisch / README.md
Last active May 23, 2020
Render some Markdown file to HTML and show it in your browser
View README.md

Preview Markdown files locally

Render some Markdown file to HTML and show it in your browser.

This is useful when you want to check a Markdown file before pushing it onto GitHub/GitLab/etc or if you want to simply print a nice looking Markdown file. Just print it from your browser.

The look is broadly similar to that on GitHub but stripped down to the bare minimum. It can also be changed easily. Just have a look at the

@markusfisch
markusfisch / README.md
Last active Apr 8, 2020
Play nethack while you wait for some process (like a looong build)
View README.md

Play nethack while you wait for some process

Like a looong build.

Prerequisites

Obviousely you need to have nethack.

Less obviousely, you also need tmux because I use tmux. Sorry ;)

View README.md
@markusfisch
markusfisch / README.md
Last active Jan 2, 2020
Make a collage in shape of 2019 of your best shots of the year
View README.md

Year In Pictures

Take your best picture of this year, put them into a folder and run this script:

$ python3 yip.py PICTURE_FOLDER

You'll get a collage in shape of 2019 where the digits are made from your pictures:

View README.md

Time Calculator

Quickly calculate when it's time to leave or when something will be over.

Because the calculation of clock times is a bit cumbersome. At least if it is not carried out regularly.

Examples

Here, I want to be somewhere at 19:30 and have three things to do that take

@markusfisch
markusfisch / README.md
Last active Dec 19, 2018
Explore a random snippet from five different popular open source projects like a dungeon in a roguelike
View README.md

Guess the file

Explore a random snippet from five different popular open source projects like a dungeon in a Roguelike.

Can you guess what programming language or project a file is from?

Run it like this:

$ bash what_file.sh
@markusfisch
markusfisch / emojize-swift.sh
Last active Dec 16, 2017
Replace that boring variable names with funny emojis in your Swift code
View emojize-swift.sh
#!/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 / smoke.glsl
Last active Oct 22, 2019
Wallpaper smoke shader; set in on Android with Shader Editor; for best performance run with 1/8 size
View smoke.glsl
// from http://editor.thebookofshaders.com/?log=170202213311
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec2 resolution;
uniform float time;
uniform vec2 offset;
@markusfisch
markusfisch / center.sh
Last active Jan 20, 2017
Center input from stdin in terminal or return 1 if it doesn't fit
View center.sh
#!/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 / SystemBarMetrics.java
Created Jan 14, 2017
Get the size of the status, tool and navigation bar on Android
View SystemBarMetrics.java
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");
You can’t perform that action at this time.