Skip to content

Instantly share code, notes, and snippets.

View theiostream's full-sized avatar

Daniel Ferreira theiostream

View GitHub Profile
@theiostream
theiostream / idealist-to-csv.py
Created December 7, 2019 02:52
Tentatively converts IdeaList .TEX file to CSV
#!/usr/bin/python
# converts Blackwell IdeaList .TEX file to CSV
# (c) 2019 Daniel Ferreira
from array import array
from datetime import date
import csv
FIELD_TYPE_STRING = 0
@theiostream
theiostream / GNUstep-PATCHES.md
Last active September 4, 2022 22:05
GSoC '17 Product - GNUstep - "Make WebCore run on top of GNUstep"

Here follows a list of patches submitted to GNUstep:

New libraries

gnustep-boron (a reimplementation of some non-deprecated Carbon APIs)

All work on this library is part of this GSoC project. This project contains stubs and a working reimplementation of macOS Universal Type

@theiostream
theiostream / git2cl
Last active June 25, 2017 00:39
Turn a git log into a GNUstep-like ChangeLog (based on http://savannah.nongnu.org/git/?group=git2cl)
#!/usr/bin/perl
# Copyright (C) 2007, 2008 Simon Josefsson <simon@josefsson.org>
# Copyright (C) 2007 Luis Mondesi <lemsx1@gmail.com>
# * calls git directly. To use it just:
# cd ~/Project/my_git_repo; git2cl > ChangeLog
# * implements strptime()
# * fixes bugs in $comment parsing
# - copy input before we remove leading spaces
# - skip "merge branch" statements as they don't
@theiostream
theiostream / SmartTTT.java
Created December 11, 2013 02:14
Not so smart Tic Tac Toe implementation in Java. Has a pretty flawed AI (which also happens to rely on bruteforce.)
import java.util.Scanner;
public class SmartTTT {
private static int[][] t;
private static int lx, ly;
public static final int INFINITY = 2; // this is sad.
private static char ti(int i) {
char ret;
@theiostream
theiostream / Pair.m
Created November 10, 2013 17:03
A pretty simple/dumb Objective-C pair object.
@interface Pair : NSObject {
@public
id obj1;
id obj2;
}
- (id)initWithObjects:(id)object, ...;
@end
@implementation Pair
- (id)initWithObjects:(id)object, ... {
@theiostream
theiostream / CountryCode.h
Created June 26, 2013 21:15
Get a country code from Apple's StoreFront IDs.
// CountryCode.h
// (c) 2013 Bacon Coding Company, LLC.
// Licensed under the MIT License.
// I lost my time scripting this dictionary in Python than I'd have writing it.
// Regardless, it was some fun.
#import <Foundation/Foundation.h>
// Reference: http://www.apple.com/itunes/affiliates/resources/documentation/linking-to-the-itunes-music-store.html#appendix
@theiostream
theiostream / URLEncode.m
Last active December 11, 2015 17:38
URL-Encode NSStrings and NSDictionaries.
// From Cocoanetics (s/&amp/&)
static NSString *NSStringURLEncode(NSString *string) {
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)string, NULL, CFSTR("!*'();:@&;=+$,/?%#[]"), kCFStringEncodingUTF8) autorelease];
}
static NSString *NSDictionaryURLEncode(NSDictionary *dict) {
NSMutableString *ret = [NSMutableString string];
NSArray *allKeys = [dict allKeys];
for (NSString *key in allKeys) {
@theiostream
theiostream / installsdk.sh
Created January 24, 2013 16:13
Installs the iOS SDK without headers.
#!/bin/bash
######
## Installs an sdk from a dyld decache plus some goodies.
## Slightly based on BigBoss's installsdk3.
## Created by theiostream. Public Domain.
## ADVANTAGES:
## - Uses the latest on-device frameworks/libraries
## - Is completely legal
@theiostream
theiostream / cachecopier.m
Last active December 10, 2015 02:19
cachecopier
// cachecopier.m
// Copy the dyld_shared_cache into /var/tmp.
// Credits to planetbeing for the ASLR trick and theiostream for implementation.
// COMPILATION:
// arm-apple-darwin10-llvm-gcc-4.2 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -framework Foundation -mdynamic-no-pic -o cachecopier cachecopier.m
#import <Foundation/Foundation.h>
int main() {
@theiostream
theiostream / ChangeColor.m
Last active December 10, 2015 00:39
Change UIImage's color
// Heavily based on http://compileyouidontevenknowyou.blogspot.com.br/2010/12/change-colors-of-uiimage-using-uicolor.html by Dan Rosenstark
// Fix for monochrome model on the comment on the same post by Ben Cunningham
// Removal of unneeded code by Daniel Ferreira (theiostream).
static UIImage *UIImageChangeColor(UIImage *image, UIColor *color_) {
CGColorRef color = [color_ CGColor];
CGRect contextRect = (CGRect){CGPointZero, [image size]};
UIGraphicsBeginImageContext(contextRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();