Skip to content

Instantly share code, notes, and snippets.

Avatar

Mick Dekkers mickdekkers

View GitHub Profile
@mickdekkers
mickdekkers / version-check.sh
Created Nov 11, 2020
Bash snippet to require bash version >= 4
View version-check.sh
#!/usr/bin/env bash
if [[ $BASH_VERSION == [0123].* ]]; then
>&2 printf "\033[0;31mThe %s script requires bash >= v4 (released february 2009)\033[0m\n" "$0"
>&2 echo "You are using bash $BASH_VERSION"
if [[ "$(uname -s)" == Darwin* ]]; then
>&2 echo "macOS is known to include a particularly ancient version of bash due to licensing shenanigans."
>&2 printf "You can use homebrew to update it yourself: \033[1;36mbrew install bash \033[0m\n"
fi
exit 1
@mickdekkers
mickdekkers / sprite_sheet_sampling.shadron
Created Apr 29, 2020
Sprite sheet/texture atlas sampling in OpenGL/GLSL with Shadron
View sprite_sheet_sampling.shadron
// Sprite sheet/texture atlas sampling in OpenGL/GLSL with Shadron
// (c) 2020 Mick Dekkers
// This work is licensed under the terms of the MIT license. See https://opensource.org/licenses/MIT for a copy.
// Tested with the emoji spritesheets at https://github.com/iamcal/emoji-data , specifically:
// https://github.com/iamcal/emoji-data/blob/8930a29f7193cc7603765c9046edac7ca529de78/sheets-clean/sheet_apple_64_clean.png
parameter int outputSize = 300.0 : range(1, 1024);
parameter int spriteSize = 64 : range(1, 1024);
parameter int spritePadding = 2 : range(1, 100);
@mickdekkers
mickdekkers / gen-github-contributions-search-urls.sh
Created Feb 5, 2020
Generate month-by-month GitHub search urls for your own contributions to a repo in a specified year
View gen-github-contributions-search-urls.sh
#!/bin/zsh
REPO="org-foo/repo-bar"
TARGET_YEAR=2019
function encode_uri_component() {
node -e "console.log(encodeURIComponent(process.argv[1]).replace(/%20/g, '+'));" "$1"
}
function get_pr_search_url() {
@mickdekkers
mickdekkers / ts-add.sh
Last active Dec 14, 2019
ts-add bash function: yarn add with typescript types in a single command
View ts-add.sh
#!/usr/bin/env bash
# Add this function to your .bashrc/.zshrc
function ts-add () {
if [ "$1" = "--dev" ] || [ "$1" = "-D" ]; then
dev=true
shift
fi
packages=("$@")
@mickdekkers
mickdekkers / clean-js.sh
Last active Jun 27, 2020
Clean JS snippets using lebab and prettier
View clean-js.sh
function clean-js () {
local transforms='arrow,for-of,for-each,arg-rest,arg-spread,obj-method,obj-shorthand,no-strict,exponent,multi-var,let,class,commonjs,template,default-param,destruct-param,includes'
lebab --transform $transforms | prettier --no-semi --single-quote
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mickdekkers on github.
  • I am mickdekkers (https://keybase.io/mickdekkers) on keybase.
  • I have a public key ASCoJe68sNGidelx9EbpMxSuxJZbDXh5OKJZkfbKROIpYQo

To claim this, I am signing this object:

@mickdekkers
mickdekkers / after.js
Created Feb 28, 2017
Directory Named Webpack Plugin migration regex
View after.js
import Map from 'component/map'
import Carousel from 'component/carousel'
import Home from 'page/home'
@mickdekkers
mickdekkers / snazzy.xml
Last active Mar 22, 2019
Sindre Sorhus' Snazzy theme ported to ConEmu -- see https://github.com/joonro/ConEmu-Color-Themes#how-to-install for installation instructions
View snazzy.xml
<key name="Palette1" modified="2016-11-18 17:52:55" build="160710">
<value name="Name" type="string" data="Snazzy"/>
<value name="ExtendColors" type="hex" data="00"/>
<value name="ExtendColorIdx" type="hex" data="00362a28"/>
<value name="TextColorIdx" type="hex" data="00ebf0ef"/>
<value name="BackColorIdx" type="hex" data="00362a28"/>
<value name="PopTextColorIdx" type="hex" data="00ebf0ef"/>
<value name="PopBackColorIdx" type="hex" data="00362a28"/>
<value name="ColorTable00" type="dword" data="00362a28"/>
<value name="ColorTable01" type="dword" data="00ffc757"/>
@mickdekkers
mickdekkers / SnapshotCamera.cs
Last active Apr 1, 2021
Take snapshot images of Prefabs and GameObjects in Unity using Render Textures
View SnapshotCamera.cs
using UnityEditor;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
// Object rendering code based on Dave Carlile's "Create a GameObject Image Using Render Textures" post
// Link: http://crappycoding.com/2014/12/create-gameobject-image-using-render-textures/
@mickdekkers
mickdekkers / SM26G.cfg
Created Jul 19, 2016
LIRC/WinLIRC remote config for Maiko Smartcool SM26G Air Conditioner
View SM26G.cfg
#
# this config file was automatically generated
# using lirc-0.9.0(emulation) on Sat Jul 02 17:18:59 2016
#
# contributed by Mick Dekkers <mickdekkersnl@gmail.com>
#
# brand: Maiko
# model no. of remote control: SM26G
# supported devices: SM26G Air Conditioner
#