Skip to content

Instantly share code, notes, and snippets.

View cmaier's full-sized avatar
🦎

Christian Maier cmaier

🦎
View GitHub Profile
@cmaier
cmaier / git-status-interactive
Created October 21, 2019 10:49
A simple editor-based interactive git status.
#!/usr/bin/env sh
#
# git-status-interactive
#
# An obnoxiously basic script to open the results of git status in a
# text editor so a user can annotate it, and then turn one-letter user instructions
# into commands to add/remove files to/from the staging area, ignore files,
# et cetera.
# See the writeup for details at http://modelingwithdata.org/arch/00000031.htm
@cmaier
cmaier / tinypng_shell_fun.sh
Last active April 30, 2019 11:30
A simple bash/zsh/... function for uploading a local image file to TinyPNG and overriding the locale file by the downloaded shrinked image. More info: https://tinypng.com/developers
tinypng() {
if [[ ! -f "$1" ]]; then
echo "File does not exist: $1"
return
fi
TINYPNG_API_KEY="apitoken" # REPLACE THIS WITH YOUR OWN
TINYPNG_IMAGE_URL_HEADER="location"
@cmaier
cmaier / karabiner_config_generator.kts
Last active January 6, 2022 10:07
SpaceFN Config Generator with Vanilla Profile
#!/usr/bin/env kotlinc -script
val SIMULTANEOUS_MANIPULATOR_MASK = """ {
"from": {
"modifiers": {
"optional": [
"any"
]
},
"simultaneous": [
@cmaier
cmaier / KarabinerConfigGenerator.kt
Last active January 6, 2022 10:07
SpaceFN Config Generator with Vanilla Profile
val rules = listOf(
Rule(
description = "SpaceFN: Space enables SpaceFN mode, Space+b to Space (hold to repeat) (see: https://geekhack.org/index.php?topic=51069.0)",
manipulators = mapOf(
"b" to "spacebar"
)
),
Rule(
description = "SpaceFN: Space+[ijkl] to Up, Left, Down, Right",
manipulators = mapOf(
@cmaier
cmaier / keybase.md
Created September 27, 2018 06:12 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@cmaier
cmaier / Material Dark.icls
Last active November 24, 2017 14:14
Modified Material Dark theme from Roman Nurik's https://romannurik.github.io/SlidesCodeHighlighter/ Raw
<!--
1. Install the Roboto Mono Regular font - https://fonts.google.com/specimen/Roboto+Mono?selection.family=Roboto+Mono
2. Copy `Material Dark.icls` to `~/Library/Preferences/AndroidStudio3.0/colors/`
3. Restart AS
4. Preferences > Editor > Color and Fonts > select Material Dark and press OK
-->
<scheme name="Material Dark" version="142" parent_scheme="Darcula">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
package me.sieben.kotlinutils
import io.kotlintest.matchers.shouldBe
import io.kotlintest.specs.WordSpec
import org.junit.Assert.assertNotNull
class AdditionalTuplesTest : WordSpec() {
init {
package me.sieben.kotlinutils
import java.io.Serializable
inline fun <A, B, R> Pair<A?, B?>.letNotNull(block: (A, B) -> R): R? = when (null) {
first, second -> null
else -> block(first as A, second as B)
}
inline fun <A, B, C, R> Triple<A?, B?, C?>.letNotNull(block: (A, B, C) -> R): R? = when (null) {
@cmaier
cmaier / osx_ramdisk.sh
Created November 10, 2016 10:54 — forked from jnschulze/osx_ramdisk.sh
Move Chrome, Safari and iTunes Cache to Ramdisk.
#!/bin/bash
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB
#DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864`
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152`
/usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK
CACHEDIR="/Volumes/RamDiskCache/$USER"

Keybase proof

I hereby claim:

  • I am cmaier on github.
  • I am cmaier (https://keybase.io/cmaier) on keybase.
  • I have a public key whose fingerprint is A8B7 1FEC 33C6 A0BE E20D 484C 9BD0 D79F 0C5D 3032

To claim this, I am signing this object: