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/ruby | |
# Log in to Red Hot Pawn, check if there are games waiting, and print a message | |
# indicating the result. | |
require 'net/http' | |
require 'uri' | |
MAIL='you@example.com' | |
PASS='password' | |
QUERY_URL=URI::parse('http://www.redhotpawn.com/xml/xstatus/gameswaitingxml.php') |
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
- (NSImage *)blankImageOfSize:(NSSize)size; | |
{ | |
NSBitmapImageRep *rep=[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL | |
pixelsWide:size.width | |
pixelsHigh:size.height | |
bitsPerSample:8 | |
samplesPerPixel:4 | |
hasAlpha:YES | |
isPlanar:NO | |
colorSpaceName:NSDeviceRGBColorSpace |
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
// This is based on https://github.com/roddi/ValidateStoreReceipt | |
// However, we use a hard coded SHA-1 hash to check the root cert, rather than the going to the keychain. | |
// Sorry for bad indenting. It looks OK in my Xcode! | |
// link with Foundation.framework and IOKit.framework libCrypto (via -lcrypto in Other Linker Flags) | |
// #import <Foundation/Foundation.h> | |
// #include <openssl/pkcs7.h> | |
// #include <openssl/objects.h> | |
// #include <openssl/sha.h> | |
// #include <openssl/x509.h> | |
// #include <openssl/err.h> |
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
# This file contains functions to handle conversion between Julian Day Number (JDN) and | |
# Julian and Gregorian dates. These algorithms are optimised for readability | |
# and non-repetition of code, rather than speed. | |
# | |
# Benchmark results for 500_000 runs on my machine: | |
# user system total real | |
# jdn_to_gregorian_direct 2.930000 0.020000 2.950000 ( 2.984025) | |
# jdn_to_gregorian 3.590000 0.020000 3.610000 ( 3.636085) | |
# jdn_to_julian 3.110000 0.020000 3.130000 ( 3.175516) | |
# user system total real |
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
# This script fixes up the CFBundleShortVersionString with a string derived from git. | |
# Place it as a Build Phase just before Copy Bundle Resources | |
# clone: git submodule add git@gist.github.com:1151287.git gist-1151287 | |
# call: ${SRCROOT}/gist-1151287/insert_version.sh | |
# PlistBuddy and git executables | |
buddy='/usr/libexec/PlistBuddy' | |
git='/usr/bin/git' |
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
tell application "Sparrow" | |
set newMessage to make new outgoing message with properties {content:"some text"} | |
compose newMessage | |
activate | |
end tell |
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
// | |
// DCUniversalAccessHelper.m | |
// dc | |
// | |
// Created by Work on 22/10/2010. | |
// Copyright 2010 Nicholas Moore. All rights reserved. | |
// | |
#import "NMUniversalAccessHelper.h" | |
#import "NMAppUtils.h" |
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/python | |
import urllib, json | |
data = json.load(urllib.urlopen('https://archive.org/metadata/asotarchive')) | |
mp3files=filter(lambda x: x.get('name','').endswith('.mp3'), data.get('files', [])) | |
mp3files.sort(cmp=lambda x,y: cmp(int(x.get('mtime',0)), int(y.get('mtime',0)))) | |
mp3name = mp3files.pop().get('name', '') | |
mp3url = 'https://' + data.get('d1', '') + data.get('dir', '') + '/' + mp3name |
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/swift | |
import Cocoa | |
print(NSSpellChecker.shared().availableLanguages); |
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
// | |
// DCStatusItemController.m | |
// dc | |
// | |
// Created by Work on 20/12/2010. | |
// Copyright 2010 Nicholas Moore. All rights reserved. | |
// | |
#import "NMStatusItemController.h" | |
#import "NMKit.h" |
OlderNewer