Skip to content

Instantly share code, notes, and snippets.

View johan's full-sized avatar

Johan Sundström johan

View GitHub Profile
@johan
johan / README.md
Last active March 1, 2024 05:26
Solar Analemmas Anywhere

Hourly solar analemmas (ignoring daylight savings time) as seen from anywhere in the world in 2014.

@johan
johan / README.md
Last active March 1, 2024 05:26 — forked from mbostock/.block

Hourly solar analemmas (ignoring daylight savings time) as seen from San Francisco in 2014.

@johan
johan / reader
Last active August 29, 2015 14:20
Osascript shell hack to engage "Reader View" after loading a url in Safari
#! /usr/bin/osascript
# opens url $1 in Safari and tries to engage its Reader View (if it shows up within 15s)
# You will probably need to first add Terminal.app here (osx Yosemite; 10.10.3):
# System Preferences -> Security & Privacy -> Privacy -> Accessibility
on run argv
set article_url to item 1 of argv
@johan
johan / list-app-widgets
Last active August 29, 2015 14:20
Two osascript hacks to inventory osx application object models, for osascripting them from shell scripts
#! /bin/sh
# lists all widgets of the app named $1 to stdout
# You will probably need to first add Terminal.app here (osx Yosemite; 10.10.3):
# System Preferences -> Security & Privacy -> Privacy -> Accessibility
osascript \
-e 'tell application "'$1'" to activate' \
-e 'tell application "System Events" to tell process "'$1'" to set output to entire contents of front window' \
@johan
johan / mix-warn
Created April 18, 2015 00:16
mixed-content warnings finder
#! /usr/bin/env phantomjs
var webpage = require('webpage')
, system = require('system')
, fs = require('fs')
, _ = require('underscore')
, URLS, MULTIPLE, OPTS = {}, OPTIONS =
{ '-v': 'verbose'
};
@johan
johan / audioplayer.psd
Last active May 30, 2016 09:23
HTML5 Audio Tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johan
johan / .gitignore
Last active February 8, 2018 11:21
Sommar & Vinter i P1: archive
/data
@johan
johan / remac.zsh
Last active July 4, 2016 13:09
osx mac address changer
function remac() {
local progress='.oO°Oo'
local airport=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport
local ssid=$($airport -I|awk '/^ *SSID/ {print $2}')
local iface=$(networksetup -listallhardwareports|grep -A1 Wi-Fi|awk '/Device:/ {print $2}')
local mac=${1:-00$(openssl rand -hex 5|sed 's/\(..\)/:\1/g')}
echo Disconnecting Wi-Fi $iface from SSID $ssid to set new mac address $mac...
sudo $airport -z
local i n=0
@johan
johan / index.md
Last active September 26, 2023 16:35
osx + java 7 = painfully easy

Step 1

Does your osx terminal speak java 7? Start Terminal.app and try: java -version:

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)