Skip to content

Instantly share code, notes, and snippets.

View felix-schwarz's full-sized avatar

Felix Schwarz felix-schwarz

View GitHub Profile
@mattstevens
mattstevens / AppStoreReceipt.h
Created October 19, 2011 02:04
An insecure but simple method of validating Mac App Store receipts using only Security.framework.
#import <Cocoa/Cocoa.h>
BOOL VerifyAppStoreReceipt();
BOOL VerifyAppStoreReceiptData(NSData *data);
NSURL *BackupReceiptURL();
void BackupAppStoreReceipt();
NSData *MACAddressData();
NSDictionary *DictionaryFromAppStoreReceipt(NSData *fullData);
@caseyohara
caseyohara / reserved_usernames.rb
Created December 9, 2011 22:58
A list of reserved usernames to avoid vanity URL collision with resource paths
# A list of possible usernames to reserve to avoid
# vanity URL collision with resource paths
# It is a merged list of the recommendations from this Quora discussion:
# http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features
# Country TLDs found here:
# http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
# Languages found here:
@ddeville
ddeville / gist:1527517
Created December 28, 2011 10:40
MIME type to UTI and back again in Cocoa
#if TARGET_OS_IPHONE
#import <MobileCoreServices/MobileCoreServices.h>
#else
#import <CoreServices/CoreServices.h>
#endif
/*
MIME type to UTI
*/
NSURLResponse *response = ... // assume a URL response from somewhere else.
@gabesumner
gabesumner / fiddle.css
Last active November 19, 2023 06:01
Address Validation using the Google Maps API
body {
font: 12px verdana;
background-color: #5C87B2;
}
form {
max-width: 400px;
padding: 15px;
background-color: white;
}
@leon
leon / play.conf
Created March 26, 2012 12:27
Upstart script for Play Framework 2.0
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/play.conf
#
# This could be the foundation for pushing play apps to the server using something like git-deploy
# By calling service play stop in the restart command and play-start in the restart command.
#
# Usage:
# start play
# stop play
# restart play
@catlan
catlan / gist:3946586
Created October 24, 2012 15:02
Little Snitch and his Friends
if ([[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.metakine.handsoff"])
{
NSAlert *alert = [NSAlert alertWithMessageText:@"Letter Opener found \"Hands Off!\" application"
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"Make sure connections to www.creativeinaustria.com are allowed in \"Hands Off!\""];
[alert setIcon:[NSImage imageNamed:OMiCIcon]];
[alert runModal];
}
@zetachang
zetachang / gist:4111314
Created November 19, 2012 15:37
Instruction on adding a Acknowledgements Settings.bundle
  • To add Settings.bundle in Xcode. Command N and in Resource, choose Settings Bundle .
  • Open Root.plist in source code, paste the code below to replace it,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>
	
@nathan-osman
nathan-osman / CMakeLists.txt
Last active April 2, 2024 21:27
Generates a self-signed x509 certificate using OpenSSL.
# A simple CMake script for building the application.
cmake_minimum_required(VERSION 2.8)
project(create-x509)
# Our only dependency is OpenSSL
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
add_executable(create-x509 create-x509.cpp)
@foozmeat
foozmeat / openssl-build.sh
Last active December 12, 2023 19:41
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@stopher
stopher / ByteRangeRequestsController.java
Last active December 7, 2017 16:40
Byte range requests in Play 2 Java Controllers. Eg. for serving MP4 video files to iPhone etc.
public class ByteRangeRequestsController extends Controller {
// 206 Partial content Byte range requests
private static Result stream(long start, long length, File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
fis.skip(start);
response().setContentType(MimeTypes.forExtension("mp4").get());
response().setHeader(CONTENT_LENGTH, ((length - start) +1l)+"");
response().setHeader(CONTENT_RANGE, String.format("bytes %d-%d/%d", start, length,file.length()));