Skip to content

Instantly share code, notes, and snippets.

Robin Kunde robinkunde

Block or report user

Report or block robinkunde

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robinkunde
robinkunde / fontNames.swift
Created Aug 21, 2019
Print certain font names
View fontNames.swift
for familyName in UIFont.familyNames.sorted() {
var hasPrintedFamilyName = false
for fontName in UIFont.fontNames(forFamilyName: familyName).sorted() {
let font = UIFont(name: fontName, size: 16.0)!
guard font.fontDescriptor.symbolicTraits.contains(.traitMonoSpace) else { continue }
if !hasPrintedFamilyName {
print(familyName)
hasPrintedFamilyName = true
}
@robinkunde
robinkunde / erx_generate_static_dhcp.py
Last active Jul 12, 2018
Use this script to generate `configure` commands for static DHCP IP address assignment on EdgeRouter X
View erx_generate_static_dhcp.py
#!/usr/bin/env python3
import argparse
import os
import csv
usage = '''Use this script to generate configure commands.
Expected input csv format: identifier,identifier_suffix(optional),ignored,mac-address-with-dashes,ip4-address
First line is ignored.
View exportVisibleImages.swift
func exportVisibleImages() {
for (windowIndex, window) in UIApplication.shared.windows.enumerated() {
let prefix = "iOS\(ProcessInfo.processInfo.operatingSystemVersion.majorVersion)_window\(windowIndex)_images"
exportImages(fromRootView: window, toDirectory: "/path/to/target/directory", prefix: prefix)
}
}
func exportImages(fromRootView rootView: UIView, toDirectory directory: String, prefix: String) {
let directoryURL = URL(fileURLWithPath: directory, isDirectory: true)
try! FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)
View blog.md

When it comes to picking an analytics package for your mobile application, you have plenty of candidates to choose from: Google Firebase, Fabric, Hockeyapp, to just name a few.

These solutions vary in pricing and capabilities. However, the most important consideration for many clients is interoperability with existing analytics or business intelligence packages. For this reason, we often get requests to integrate the Google Analytics SDK into iOS and Android apps. If a mobile app’s structure hews closely to an existing website, the ability to use the same analytics suite for both allows us to easily unify reporting.

Google recently reorganized their Cocoapods offerings, moving components like their analytics package back into its own pod and deprecating the Google pod in the process.

It would have been a good time to redo their integration docs as well, but unfortunately, they are still outdated and incomplete.

I'd lik

View openSimFolderForBundleID.sh
#!/bin/bash
BUNDLE_PATH=`xcrun simctl get_app_container booted $1`
if [[ $? -ne 0 ]]; then
exit 1
fi
for f in $BUNDLE_PATH/*; do
open -R "$f"
exit;
@robinkunde
robinkunde / generic_dispatch_lock.swift
Created Jul 18, 2016
generic_dispatch_lock.swift
View generic_dispatch_lock.swift
@inline(__always) func with<T>(queue: dispatch_queue_t, @autoclosure(escaping) get block: () -> T) -> T {
assert(dispatch_queue_get_label(queue) != dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), "Invoked dispatch_sync in a way that will deadlock")
var result: T!
dispatch_sync(queue) {
result = block()
}
return result
}
View its_done.py
#!/usr/bin/env python3
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('message')
parser.add_argument('--start', type=int, help='Pass start timestamp to append run time to notification')
parser.add_argument('--apikey', type=str, help='Pushover API key (can also be implicitly defined as ENV variable in $PUSHOVER_API_KEY)', default=os.getenv('PUSHOVER_API_KEY', ''))
parser.add_argument('--userkey', type=str, help='Pushover user key (can also be implicitly defined as ENV variable in $PUSHOVER_USER_KEY)', default=os.getenv('PUSHOVER_USER_KEY', ''))
args = parser.parse_args()
@robinkunde
robinkunde / gist:8425a7b0459760e3c5e6
Created Feb 29, 2016
UIAccessibilityNotificationVoiceOverIdentifier
View gist:8425a7b0459760e3c5e6
UIAccessibilityPostNotification(UIAccessibilityPauseAssistiveTechnologyNotification, UIAccessibilityNotificationVoiceOverIdentifier)
@robinkunde
robinkunde / osx-for-hackers.sh
Created Nov 30, 2015 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
View osx-for-hackers.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@robinkunde
robinkunde / ssl_cert_expiration.sh
Last active Aug 29, 2015
Bash script that checks expiration date of SSL certificates
View ssl_cert_expiration.sh
#!/bin/bash
DATE_STRING="1 months"
display_usage() {
echo "This script displays the expiration dates of the passed SSL certificates if they expire before a set date (defaults to one month from now)."
echo "See usage of the -d parameter of the date command on how to format the optional date string."
echo -e "\nUsage:\n$0 [-d \"DATE_STRING\"] FILE... \n"
}
You can’t perform that action at this time.