Skip to content

Instantly share code, notes, and snippets.

import lldb
import re
import shlex
# This script allows Xcode to selectively ignore Obj-C exceptions
# based on any selector on the NSException instance
def getRegister(target):
if target.triple.startswith('x86_64'):
return "rdi"
@clayton
clayton / ffmpeg-install.sh
Created August 9, 2013 18:55
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@aalin
aalin / catmull_rom_splines.rb
Created June 6, 2013 10:55
Catmull-Rom splines implemented in Ruby.
# Based on https://github.com/Sojo-Studios/catmull-rom/blob/master/test.js
# This implementation assumes circular splines.
class CatmullRomSplines
def initialize(points)
@key_points = points
end
def generate(detail)
points = []
@willurd
willurd / web-servers.md
Last active April 20, 2025 00:42
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jimothyGator
jimothyGator / README.md
Last active April 20, 2025 14:44
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@mattt
mattt / uiappearance-selector.md
Last active February 7, 2025 15:27
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@lpereira
lpereira / partial.c
Last active January 29, 2023 20:12
Partial functions in C This program illustrates a hack to create partial functions in C. The way it works is that it generates a template function (partial_template_function) with known pointers, that is later copied to a region of memory obtained with mmap(), patched up with the address and data to be passed to the real function, and then made …
/*
* Partial applied functions in C
* Leandro Pereira <[email protected]>
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
@0xced
0xced / gdb_image_notifier.txt
Created December 7, 2012 09:13
SIGSTOP in gdb_image_notifier
* thread #1: tid = 0x1c03, 0x8fef79d9 dyld`gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*), stop reason = signal SIGSTOP
frame #0: 0x8fef79d9 dyld`gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*)
frame #1: 0x8fef765d dyld`notifyGDB(dyld_image_states, unsigned int, dyld_image_info const*) + 41
frame #2: 0x8feee9c2 dyld`dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) + 907
frame #3: 0x8feebf5f dyld`dyld::notifyBatch(dyld_image_states) + 23
frame #4: 0x8fef8ffb dyld`ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&) + 103
frame #5: 0x8feeecc3 dyld`dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&) + 473
frame #6: 0x8fef459a dyld`dlopen + 611
frame #7: 0x02b0efc4 libdyld_sim.dylib`dlopen + 70
frame #8: 0x00fbf456 UIKit`DataDetectorsUIGetClass + 45
@hartbit
hartbit / cocos2d.podspc
Created November 9, 2012 16:22
cocos2d 2.0 podspec
Pod::Spec.new do |s|
s.name = 'cocos2d'
s.license = 'MIT'
s.version = '2.0.0'
s.summary = 'cocos2d for iPhone is a framework for building 2D games, demos, and other graphical/interactive applications.'
s.description = 'cocos2d for iPhone is a framework for building 2D games, demos, and other graphical/interactive applications for iPod Touch, iPhone, iPad and Mac. It is based on the cocos2d design but instead of using python it, uses objective-c.'
s.homepage = 'http://www.cocos2d-iphone.org'
s.author = { 'Ricardo Quesada' => '[email protected]', 'Zynga Inc.' => 'https://zynga.com/' }
s.source = {:git => 'https://github.com/cocos2d/cocos2d-iphone.git', :tag => 'release-2.0'}
@babatakao
babatakao / Sinatra_WEBrick_DoNotReverseLookup.rb
Created October 18, 2012 07:50
SinatraでWEBrickのDNS逆引きを抑制するサンプル
require 'sinatra'
class Rack::Handler::WEBrick
class << self
alias_method :run_original, :run
end
def self.run(app, options={})
options[:DoNotReverseLookup] = true
run_original(app, options)
end