Skip to content

Instantly share code, notes, and snippets.

View adamnemecek's full-sized avatar

adamnemecek

View GitHub Profile
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
/**
* Utility lib for setting/unsetting JavaScript breakpoints
*
* Usage:
* breakpoint.set('globalMethodName');
* breakpoint.unset('globalMethodName');
*
* breakpoint.set('namespacedMethodName', namespaceObject);
* breakpoint.unset('namespacedMethodName', namespaceObject);
*/
@adamnemecek
adamnemecek / .lldbinit
Last active August 29, 2015 14:25 — forked from zrxq/.lldbinit
comma script import ~/lldb/subl.py
comma script add -f subl.subl subl
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
% swiftc -Xllvm -help-hidden /tmp/foo.swift
USAGE: swift (LLVM option parsing) [options]
OPTIONS:
-a9-754319-workaround - Enable workarounds for A9 HW bugs #754319
-a9-754320-workaround - Enable workarounds for A9 HW bugs #754320
-aarch64-use-tbi - Assume that top byte of an address is ignored
-agg-antidep-debugdiv=<int> - Debug control for aggressive anti-dep breaker
-agg-antidep-debugmod=<int> - Debug control for aggressive anti-dep breaker
-aggressive-ext-opt - Aggressive extension optimization
import Cocoa
enum CoroutineState {
case Fresh, Running, Blocked, Canceled, Done
}
struct CoroutineCancellation: ErrorType {}
class CoroutineImpl<InputType, YieldType> {
let body: (yield: YieldType throws -> InputType) throws -> Void
func responderForType<T>(from: UIResponder) -> T? {
var current = from
while let next = current.nextResponder() {
if let result = next as? T { return result }
current = next
}
return nil
}
@adamnemecek
adamnemecek / mcmc_exercices.py
Created August 31, 2016 20:45 — forked from mblondel/mcmc_exercices.py
MCMC exercises
"""
Exercises for the Markov Chain Monte-Carlo (MCMC) course available at
http://users.aims.ac.za/~ioana/
"""
import numpy as np
import numpy.linalg as la
import pylab
from scipy import stats
func encode<T>(var value: T) -> NSData {
return withUnsafePointer(&value) { p in
NSData(bytes: p, length: sizeofValue(value))
}
}
func decode<T>(data: NSData) -> T {
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type))
data.getBytes(pointer)
enum Expr {
case Lit(Int)
indirect case Neg(Expr)
indirect case Add(Expr,Expr)
indirect case Mul(Expr,Expr)
indirect case Sub(Expr,Expr)
}
let spaces = many(oneof(" \n\r"))
func token<P: ParserType>(p: P) -> Parser<P.A> {