Skip to content

Instantly share code, notes, and snippets.

View CocoaBeans's full-sized avatar

Kevin Ross CocoaBeans

View GitHub Profile
@mikeash
mikeash / gist:1355671
Created November 10, 2011 18:28
Multiple return
// clang -W -Wall -Wno-unused-parameter -framework Foundation -fobjc-arc test.m
#import <Foundation/Foundation.h>
#define IDARRAY(...) ((id[]){ __VA_ARGS__ })
#define IDCOUNT(...) (sizeof(IDARRAY(__VA_ARGS__)) / sizeof(id))
typedef id (^Tuple)(int);
@0xc010d
0xc010d / ReCodeSign
Created November 14, 2011 22:38
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
- Copy the delivered ipa into a directory to work in.
- export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy
will need to be written as the full path.
- Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its
resources.
- Enter the command "codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/" This pulls the entitlements out of the app, and
prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.
@spycos
spycos / PhotoGrabber.h
Created February 7, 2012 00:19 — forked from erkie/PhotoGrabber.h
Capture photos from built in iSight-camera or other connected cameras using Objective-C
//
// PhotoGrabber.h
// By Erik Rothoff Andersson <erikrothoff.com>
//
#import <Foundation/Foundation.h>
#import <QTKit/QTKit.h>
@protocol PhotoGrabberDelegate <NSObject>
@CocoaBeans
CocoaBeans / KRStaticAnalyzerAnnotations.h
Created February 21, 2012 20:05
KRStaticAnalyzerAnnotations.h - Source code notations for the clang static analyser
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// KRStaticAnalyzerAnnotations.h
///
/// The Clang frontend supports several source-level annotations in the form of GCC-style attributes and pragmas
/// that can help make using the Clang Static Analyzer more useful. These annotations can both help suppress
/// false positives as well as enhance the analyzer's ability to find bugs.
///
/// For more info see: http://clang-analyzer.llvm.org/annotations.html
///
@CocoaBeans
CocoaBeans / DirectoryDestoryer.command
Last active October 4, 2015 15:37
Corrupt journal and bitmap of a given disk identifier
#!/bin/bash
#########################################################################################
###
### DirectoryDestoryer.command
### Corrupt journal and bitmap of a given disk identifier
###
### Copyright (c) 2013 Kevin Ross. All rights reserved.
###
### Redistribution and use in source and binary forms, with or without modification,
@nertzy
nertzy / README
Created December 9, 2012 22:32 — forked from symposion/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@r2k0
r2k0 / Think_FIB_Plot_1
Last active December 8, 2019 23:41
Automatic Opening Range and Fibonacci Levels This Thinkscript is designed to plot the OR high, low, 50% fib retrace, and fib extensions for the current day. This will only work correctly on time-based charts, where the OR time frame is divisible by the bar period e.g. 30 minute OR, 10 min bars. An extra fib extension may be used if desired to cr…
#
def na=double.nan;
#
# Define time that OR begins (in hhmm format,
# 0930 is the default):
#
input ORBegin = 0930;
#
# Define time that OR is finished (in hhmm format,
# 10:00 is the default):
@CocoaBeans
CocoaBeans / git-delete-tag
Created January 16, 2013 19:26
Delete a tag from the local git repository and push it to origin
#!/bin/bash #-x
GIT_TAG="${1}"
echo "Deleting remote git tag: ${GIT_TAG}"
git tag -d "${GIT_TAG}"
git push origin ":refs/tags/${GIT_TAG}"
@CocoaBeans
CocoaBeans / .gitignore
Created January 16, 2013 19:53
Common .gitignores for Cocoa development
*.xcuserdatad/
docset-installed.txt
# OS X Finder
.DS_Store
# Xcode per-user config
*.mode1
*.mode1v3
*.mode2v3
@CocoaBeans
CocoaBeans / .gitattributes
Created January 16, 2013 20:05
Common .gitattributes for Cocoa development
##################################################
## Attribute for diff'ing UTF-8 .strings files
*.strings -crlf set diff
##################################################
## Attribute to for easy merging of Xcode project files
*.pbxproj merge=union