Skip to content

Instantly share code, notes, and snippets.

View martinbalfanz's full-sized avatar

Martin Balfanz martinbalfanz

View GitHub Profile
@martinbalfanz
martinbalfanz / adguard
Last active October 16, 2019 07:38
A little wrapper for AdGuardHome that automatically adjusts DNS settings. Command line parameters are passed on to AdGuard. OS X & Wi-Fi only
#!/bin/bash
current_dns="$(networksetup -getdnsservers Wi-Fi | tr '\n' ' ')"
dns_set () {
networksetup -setdnsservers Wi-Fi "$@"
}
dns_reset () {
if [[ "$current_dns" =~ ^There.* ]]; then
### Keybase proof
I hereby claim:
* I am martinbalfanz on github.
* I am martinbalfanz (https://keybase.io/martinbalfanz) on keybase.
* I have a public key ASD27ZfNzMx3CnPcoaOyu-jJZom_vEjzDx7orChL3wUArQo
To claim this, I am signing this object:
@martinbalfanz
martinbalfanz / remove-orphaned-raw-images.py
Last active November 25, 2018 18:39 — forked from pklaus/remove-orphaned-raw-images.py
Do you own a DSLR? If so, do you transfer your images to your computer, then look at the JPEGs and delete the crappy ones? If you do, your RAW images may be leftover. This Python script helps you cleaning up your image folders after deleting unwanted JPEGs. See http://blog.philippklaus.de/2012/12/cleaning-leftover-raw-images-after-selecting-imag…
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Written on 2012-12-12 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
Check <https://gist.github.com/4271012> for newer versions.
Also check <https://gist.github.com/3155743> for a tool to
rename JPEGs according to their EXIF shot time.
"""
@martinbalfanz
martinbalfanz / mini-playground.md
Last active October 23, 2018 12:36
mini code playground

This bookmarklet gives you a small code playground and allows you to copy your result as shareable dataurl.

data:text/html;charset=utf-8,<body oninput="var x=(h.value?h.value:'')+(c.value?'<style>'+c.value+'</style>':'')+(j.value?'<script>'+j.value+'<\/script>':'');document.querySelector('iframe').srcdoc=x;i.value='data:text/html;charset=utf-8,'+encodeURIComponent(x)"><style>*{box-sizing:border-box}body{margin:0}iframe,textarea{width:100%;height:49vh;float:left}textarea{font-family:monospace;width:33.33%}input{width:90%}button{width:10%;background:lightgrey}</style><input id=i type=text placeholder=dataurl readonly><button onclick="document.getElementById('i').select();document.execCommand('copy')">copy</button><textarea id=h placeholder=html></textarea><textarea id=c placeholder=css></textarea><textarea id=j placeholder=js></textarea><iframe>

adapted from this codepen

@martinbalfanz
martinbalfanz / cloudSettings
Last active January 22, 2019 12:59
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-01-22T12:59:57.851Z","extensionVersion":"v3.2.4"}

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@martinbalfanz
martinbalfanz / diary.sh
Created September 18, 2016 12:35
Small script for quickly creating diary entries
#!/bin/bash
diary=~/Dropbox/notes/diary.md
year=$(date +"%Y")
month=$(date +"%m")
today=$(date +"%Y-%m-%d (%A)")
now=$(date +"%H:%M:%S")
if [ ! -e "$diary" ]; then
touch $diary
@martinbalfanz
martinbalfanz / update-site-lisp.sh
Created June 29, 2014 19:21
Update all git submodules inside my emacs site-lisp directory.
#!/bin/bash
ConfigDir=~/emacs-config
ModulesDir=~/emacs-config/site-lisp
SiteLispDirs=~/emacs-config/site-lisp/*/
for dir in $SiteLispDirs; do
if [[ -f $dir/.git ]];
then
cd $dir
@martinbalfanz
martinbalfanz / gist:9804147
Created March 27, 2014 10:00
gumby framework rem with px mixin
// Typography mixins
// Fonts in rems with px fallback
@mixin font-size($size, $is-important: false) {
$size: if(unitless($size), $size, $size / 1px);
@if $is-important {
font-size: $size + px !important;
font-size: ($size / strip-units($base-font-size)) + rem !important;
// https://gist.github.com/martinbalfanz/8218248
;(function ($) {
$(function () {
var getTallestElement = function (elems) {
var heights = elems.map(function () {
return parseInt($(this).css("height"), 10);
}).get();
return Math.max.apply(Math, heights);