Skip to content

Instantly share code, notes, and snippets.

View Jpunt's full-sized avatar

Jasper Haggenburg Jpunt

View GitHub Profile
@Jpunt
Jpunt / btt-toggle-appearance.json
Created September 25, 2018 12:26
BetterTouchTool: Toggle Mojave appearance on the Touch Bar
{
"BTTWidgetName" : "Toggle appearance",
"BTTTriggerType" : 639,
"BTTTriggerTypeDescription" : "Apple Script Widget",
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : 195,
"BTTPredefinedActionName" : "Run Apple Script (async in background)",
"BTTInlineAppleScript" : "tell application \"System Events\"\r\ttell appearance preferences\r\t\tset dark mode to not dark mode\r\tend tell\rend tell",
"BTTEnabled2" : 1,
"BTTUUID" : "ECC2514E-86E5-4304-AABA-BA7749257FDC",
@Jpunt
Jpunt / npm-alfred.md
Created July 12, 2018 09:12
Some handy shortcuts for npm and Alfred

npm shortcuts for Alfred

screenshot

Copy/paste these into Safari and it will add it to Alfred

Search for package

alfred://customsearch/Search%20npm%20for%20%27%7Bquery%7D%27/npm/utf8/nospace/https%3A%2F%2Fwww.npmjs.com%2Fsearch%3Fq%3D%7Bquery%7D
@Jpunt
Jpunt / drobo_check.py
Created May 7, 2013 06:57
Python script I use to check the health of my Drobo, which is connected to a Raspberry Pi. Output is emailed by the cronjob daily. Needs Drobo-Utils to work properly: http://drobo-utils.sourceforge.net and you will have to edit the paths for your setup.
#! /usr/bin/env python
import subprocess
import re
# Settings
diskPath = '/dev/sda'
mountPath = '/media/drobo'
# Get status
command = "/usr/sbin/drobom status"

Keybase proof

I hereby claim:

  • I am jpunt on github.
  • I am jpunt (https://keybase.io/jpunt) on keybase.
  • I have a public key whose fingerprint is 0BB3 1062 FEB1 9586 7C99 BAA1 0233 D5E8 8124 495E

To claim this, I am signing this object:

const jsdom = require("jsdom");
jsdom.env({
html: `
<!DOCTYPE html>
<body>
<script>
var script = document.createElement("script");
script.setAttribute('type', 'application/javascript');
script.textContent = "ran = true;";
const jsdom = require("jsdom");
jsdom.env({
html: `
<!DOCTYPE html>
<body>
<script>
var script = document.createElement("script");
script.setAttribute('type', 'application/javascript');
script.textContent = "ran = true;";
@Jpunt
Jpunt / console-fallback.js
Last active January 2, 2016 17:09
Fallback to use things like console.log() but not have it kill old browsers.
// This is not some kind of polyfill! It's just to prevent old browsers from failing horribly
var fallback = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn', 'table'];
if(typeof console === 'undefined') {
var console = {};
}
for(var i in methods) {
@Jpunt
Jpunt / encode.sh
Last active January 1, 2016 20:09
A tiny bit of ZSH and Handbrake-magic to encode DVD's into mp4's
#!/usr/bin/env zsh
#
# Turns ISO-files and VIDEO_TS-directories from $encode_path into decent H264-encoded mp4's (audio/subtitle-tracks are included).
#
# Requirements:
# - ZSH
# - HandBrakeCLI
encode_path=~/Desktop/Encode
handbrake_path=/usr/bin/HandBrakeCLI
@Jpunt
Jpunt / moveit.js
Created December 30, 2013 20:28
Little node-script to find *.iso's in my collection and move them to temporary directories to either encode, redownload or delete them later on.
var glob = require('glob');
var path = require('path');
var cli = require('cline')();
var fs = require('fs');
var fromBase = '/Volumes/Video/Movies';
var toDownload = '/Volumes/Video/TODO/Download';
var toEncode = '/Volumes/Video/TODO/Encode';
var toDelete = '/Volumes/Video/TODO/Delete';
/*global $ */
/*
_______ _______ _______ _______ _______ _______ _______ ___ _
| || _ || || || _ || || || | | |
| ___|| |_| || || ___|| |_| || _ || _ || |_| |
| |___ | || || |___ | || | | || | | || _|
| ___|| || _|| ___|| _ | | |_| || |_| || |_
| | | _ || |_ | |___ | |_| || || || _ |