This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIAccessibilityPostNotification(UIAccessibilityPauseAssistiveTechnologyNotification, UIAccessibilityNotificationVoiceOverIdentifier) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am robinkunde on github. | |
* I am robinkunde (https://keybase.io/robinkunde) on keybase. | |
* I have a public key whose fingerprint is 74B3 6554 9086 90BA A7C1 25B0 9491 BAB4 65E0 3C6B | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OSX for Hackers (Mavericks/Yosemite) | |
# | |
# Source: https://gist.github.com/brandonb927/3195465 | |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *hexEncodedStringFromData(NSData *data) | |
{ | |
static const char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; | |
// Store the length, otherwise it would be re-evalued on each loop iteration | |
NSUInteger length = data.length; | |
// malloc result data NULL terminated string | |
char *resultData = malloc(length * 2 + 1); | |
const unsigned char *sourceData = (const unsigned char *)data.bytes; |
NewerOlder