Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Ferreira theiostream

View GitHub Profile
@theiostream
theiostream / idealist-to-csv.py
Created Dec 7, 2019
Tentatively converts IdeaList .TEX file to CSV
View idealist-to-csv.py
#!/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 Sep 4, 2022
GSoC '17 Product - GNUstep - "Make WebCore run on top of GNUstep"
View GNUstep-PATCHES.md

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 Jun 25, 2017
Turn a git log into a GNUstep-like ChangeLog (based on http://savannah.nongnu.org/git/?group=git2cl)
View 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 Dec 11, 2013
Not so smart Tic Tac Toe implementation in Java. Has a pretty flawed AI (which also happens to rely on bruteforce.)
View SmartTTT.java
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 Nov 10, 2013
A pretty simple/dumb Objective-C pair object.
View Pair.m
@interface Pair : NSObject {
@public
id obj1;
id obj2;
}
- (id)initWithObjects:(id)object, ...;
@end
@implementation Pair
- (id)initWithObjects:(id)object, ... {
@theiostream
theiostream / CountryCode.h
Created Jun 26, 2013
Get a country code from Apple's StoreFront IDs.
View CountryCode.h
// 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 Dec 11, 2015
URL-Encode NSStrings and NSDictionaries.
View URLEncode.m
// 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 Jan 24, 2013
Installs the iOS SDK without headers.
View installsdk.sh
#!/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
View cachecopier.m
// 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 Dec 10, 2015
Change UIImage's color
View ChangeColor.m
// 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();