Skip to content

Instantly share code, notes, and snippets.

View billymeltdown's full-sized avatar

Billy Gray billymeltdown

View GitHub Profile
@billymeltdown
billymeltdown / openDB.m
Created August 25, 2017 16:18
Using sqlite3_key to open a SQLCipher db in Objective-C
#import <sqlite3.h>
NSString *databasePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
stringByAppendingPathComponent: @"sqlcipher.db"];
sqlite3 *db;
bool sqlcipher_valid = NO;
if (sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {
const char* key = [@"BIGSecret" UTF8String];
sqlite3_key(db, key, strlen(key));
@billymeltdown
billymeltdown / What's New
Created October 28, 2015 04:00
Trello 3.3.1 Release Notes
Trello iOS 3.3.1 is bugfix release with fixes for missing boards, French translations, and crashy team-related notifications. Also, the nostalgia you would feel upon archiving a card with a faded lithograph of your friend from long ago has been intensified and then removed from the app.
~ ~ ~
TRELLO iOS 3.3 RELEASE NOTES
Our iOS 9 release!
• On newer iPads, open the app in Split View and Slide Over. Get more done when you use Trello alongside your other favorite apps.
• On iPhone 6S and 6S+, peek and pop open cards with 3D Touch. Then, three-dimensionally touch the Trello app icon for Quick Actions. You can check out your notifications or create cards right from the home screen.
@billymeltdown
billymeltdown / build-shell.sh
Created February 24, 2015 21:11
Building SQLCipher CLI
cc -framework Security \
-mmacosx-version-min=10.7 \
-I${SQLCIPHER_DIR} \
-o ./sqlcipher ${SQLCIPHER_DIR}/src/shell.c \
/path/to/libsqlcipher.a
@billymeltdown
billymeltdown / ditto_funcs.c
Last active August 29, 2015 14:14
A snippet of ditto
static void ditto_createFunc(sqlite3_context *context, int argc, sqlite3_value **argv) {
sqlite3 *db = sqlite3_context_db_handle(context);
if(ditto_exec(db,
"CREATE TABLE ditto_log ("
" rep_id TEXT NOT NULL,"
" csn INTEGER NOT NULL,"
" timestamp DATETIME NOT NULL,"
" type TEXT NOT NULL,"
" object_name TEXT NOT NULL,"
@billymeltdown
billymeltdown / SecureLoginDelegate-AppDelegate.m
Created January 20, 2015 21:31
Sample code cut from some messing with SecureLoginDelegate for a SQLCipher iOS tutorial
//
// AppDelegate.m
// SecureLoginDelegate
//
// Created by Billy Gray on 10/19/14.
// Copyright (c) 2014 Zetetic. All rights reserved.
//
#import "AppDelegate.h"
#import <sqlite3.h>
@billymeltdown
billymeltdown / PhaseScriptExecution Run Script
Created December 2, 2014 19:03
sqlcipher.xcodeproj amalgamation target build errors in Xcode 6.1
PhaseScriptExecution Run\ Script /Users/billy/Library/Developer/Xcode/DerivedData/SQLCipherSpeed-cqrfepqyetjdfxbhaqmkjlkhzbxm/Build/Intermediates/sqlcipher.build/Debug-iphoneos/amalgamation.build/Script-9069D08A0FCE185A0042E34C.sh
cd /Users/billy/Documents/Sources/SQLCipherSpeed/sqlcipher
export ACTION=build
export AD_HOC_CODE_SIGNING_ALLOWED=NO
export ALTERNATE_GROUP=staff
export ALTERNATE_MODE=u+w,go-w,a+rX
export ALTERNATE_OWNER=billy
export ALWAYS_SEARCH_USER_PATHS=YES
export ALWAYS_USE_SEPARATE_HEADERMAPS=YES
export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
@billymeltdown
billymeltdown / gist:ae6b26e8693c0ff83810
Created May 27, 2014 20:57
keybase identity verification
### Keybase proof
I hereby claim:
* I am billymeltdown on github.
* I am billymeltdown (https://keybase.io/billymeltdown) on keybase.
* I have a public key whose fingerprint is 0EED A3EF C881 B376 1DF4 4BFD 6BDF 18EB 9D6B 3CE7
To claim this, I am signing this object:
@billymeltdown
billymeltdown / ZTTooManyHostParameters.sql
Created March 12, 2014 20:53
An hilarious but unintentionally generated query that ran up against SQLite's limit of 999 host parameters in a single SQL statement
DELETE FROM entries WHERE category_id = ? AND id NOT IN ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
@billymeltdown
billymeltdown / DataModel.m
Last active August 29, 2015 13:57
Fetching SQLite table column information
+ (NSDictionary *)scanTableColumns {
// Basically: PRAGMA table_info( your_table_name );
NSMutableDictionary *columns = [[[NSMutableDictionary alloc] init] autorelease];
NSString *sql = [NSString stringWithFormat:@"PRAGMA table_info( '%@' );", [[self class] tableName]];
[[self class] execute:sql withBlock:^(sqlite3_stmt *stmt) {
NSMutableDictionary *column = [NSMutableDictionary dictionary];
const unsigned char *cName;
NSString *stringName = @"Unknown Column";
cName = sqlite3_column_text(stmt, 1); // name is col 1
if (cName != NULL) {
@billymeltdown
billymeltdown / MyOldWays.m
Last active August 29, 2015 13:56
Coding Styles
- (IBAction)killingMeSoftlyWith:(id)thisSong
{
if (self.fugeez) // NEVER do this
self.jam = thisSong;
self.jam = [self somethingElse];
}