Skip to content

Instantly share code, notes, and snippets.

View 0xced's full-sized avatar

Cédric Luthi 0xced

View GitHub Profile
@0xced
0xced / install-iphone-sdk-3.1.3.sh
Created September 13, 2010 18:43
Install iPhone SDK 3.1.3 script
#!/bin/bash -e
# More information at http://0xced.blogspot.com/2010/07/using-sdk-313-with-iphone-sdk-4.html
IPHONE_SDK_DMG="$HOME/Downloads/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg"
DEVELOPER_DIR="/Developer"
MOUNT_POINT="/Volumes/iPhone SDK"
function cleanup
{
echo ""
#!/usr/bin/env python
# Nicolas Seriot
# 2011-01-06
# https://gist.github.com/768457
"""
Input: path of an Objective-C project
Output: import dependancies Graphviz format
@0xced
0xced / Makefile
Created April 22, 2011 23:07
Demonstrates gcc 4.2.1 variadic function weirdness for x86_64 architecture
# $ gcc --version
# i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
# Copyright (C) 2007 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# $ clang --version
# Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn)
# Target: x86_64-apple-darwin10
# Thread model: posix
@0xced
0xced / tsr_download.py
Created April 27, 2011 08:57
Download TSR medias
#!/usr/bin/env python
import json, os, subprocess, sys, urllib2
from termcolor import cprint
from xml.dom import minidom
def abort(error):
cprint(error, color='red', file=sys.stderr)
exit(1)
@0xced
0xced / Makefile
Created May 20, 2011 13:22
Swiss Franc currency symbol
all: chf
chf: chf.m
gcc chf.m -o chf -framework Foundation -std=c99
clean:
rm -f chf
@0xced
0xced / NSData+CommonDigest.h
Created May 23, 2011 09:00
NSData+CommonDigest: The most elegant NSData category for cryptographic hash functions
/*
Licensed under the MIT License
Copyright (c) 2011 Cédric Luthi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@0xced
0xced / pollWWDCVideos.py
Created June 16, 2011 21:01
Notify when WWDC videos are available
#!/usr/bin/env python
import datetime, httplib, os, sys
if "DOCUMENT_ROOT" in os.environ:
sys.path.append(os.environ["DOCUMENT_ROOT"] + "/python")
from prowl import WWDCVIDEOS_PROWL_API_KEYS
import pyrowl
@0xced
0xced / NSURLBug.m
Created July 6, 2011 15:09
Demonstrates NSURL crash when subclassing, see http://www.openradar.me/9729706
#import <Foundation/Foundation.h>
@interface MyURL : NSURL
@end
@implementation MyURL
@end
void testURL(Class urlClass, NSString *string)
{
@0xced
0xced / NSURLWithParameters.m
Last active December 20, 2018 10:54
How to (ab)use TWRequest to create a NSURL with parameters easily
{
NSURL *baseURL = [NSURL URLWithString:@"http://duckduckgo.com/"];
NSDictionary *parameters = @{ @"q" : @"TWRequest -site:apple.com" };
// With TWRequest: 1 line with **correct percent escaping**
NSURL *urlA = [[[[TWRequest alloc] initWithURL:baseURL parameters:parameters requestMethod:TWRequestMethodGET] signedURLRequest] URL];
// Without TWRequest: 10 lines with wrong percent escaping (http://www.openradar.me/6546984)
NSMutableString *query = [NSMutableString string];
for (NSString *key in parameters)
@0xced
0xced / NSData+Base64.h
Created February 24, 2012 15:03
NSData Base64 category
//
// Created by Cédric Luthi on 2012-02-24.
// Copyright (c) 2012 Cédric Luthi. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSData (Base64)
+ (id) dataWithBase64Encoding_xcd:(NSString *)base64String;