Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
VictorTaelin / fast_dps_add_carry.md
Last active November 8, 2024 09:26
Fast Discrete Program Search with HVM Superpositions (SUP nodes) - finding ADD-CARRY

HOC's Fast Discrete Program Search (DPS)

HOC will soon (EOY?) launch an API for our DPS solution. The interface will be simple:

  • You give us a set of examples (input/output pairs)

  • We'll give you a (Python?) function that models it

And that's it. It will be an universal function finder.

@seominjoon
seominjoon / torch-install-gpu-ec2.sh
Last active October 20, 2020 03:33
Installing torch with GPU enabled on AWS EC2 (g2 instance) Ubuntu 14.04.
# install torch on ec2 g2 instance
# installing torch
curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash # prereqs
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh
source ~/.bashrc
# confirm torch is installed
th
@felix-schwarz
felix-schwarz / openssl-build.sh
Last active March 19, 2024 03:16 — forked from steipete/openssl-build.h
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
#!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
@oleganza
oleganza / async_swift_proposal.md
Last active May 12, 2023 10:06
Concrete proposal for async semantics in Swift

Async semantics proposal for Swift

Modern Cocoa development involves a lot of asynchronous programming using blocks and NSOperations. A lot of APIs are exposing blocks and they are more natural to write a lot of logic, so we'll only focus on block-based APIs.

Block-based APIs are hard to use when number of operations grows and dependencies between them become more complicated. In this paper I introduce asynchronous semantics and Promise type to Swift language (borrowing ideas from design of throw-try-catch and optionals). Functions can opt-in to become async, programmer can compose complex logic involving asynchronous operations while compiler produces necessary closures to implement that logic. This proposal does not propose new runtime model, nor "actors" or "coroutines".

Table of contents

Greetings, NSHipsters!

As we prepare to increment our NSDateComponents -year by 1, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.

Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

Here are a few examples of the kind of things I'd like to see:

  • Using NSStringFromSelector(@selector()) as a safer way to do KVC / KVO / NSCoding.
  • Panic's [rather surprising discovery about the internals of the Lightning Digital AV Adapter](http://www.panic.com/blog/the-lightning-di
@jspahrsummers
jspahrsummers / RACSocketReader.h
Last active December 14, 2015 04:59
An example of emulating an asynchronous pull-driven stream with lazy signals. The idea is that the producer (in this case, a socket) should be throttled to a speed that the consumer (the signal subscribers) can handle – accomplished here by using multiple individual signals which only read data when subscribed to.
@interface RACSocketReader : NSObject
// Sends a RACSignal whenever there's new data ready to be read. Each signal
// will send an NSData upon subscription.
//
// If you only want the NSData objects as fast as possible, simply -concat
// this signal to get a eager signal of NSData values.
@property (nonatomic, strong, readonly) RACSignal *signalOfDataSignals;
- (id)initWithSocketDescriptor:(int)fildes;
@chriseidhof
chriseidhof / nsincrementalstore.markdown
Created February 18, 2012 16:39
Accessing an API using CoreData's NSIncrementalStore

Accessing an API using CoreData's NSIncrementalStore

Note: the original location of this article is on my blog, however, it is posted here too for better readability.

In this article, we will see how to use Core Data for accessing your API. We will use the Bandcamp API as our running example. I've only been experimenting with this code for a few days, so there might be mistakes in there.

@steipete
steipete / gist:1175357
Created August 27, 2011 12:54
Easy [fade] animation for UIImageView.image
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
selected_ = selected;
if (animated) {
CATransition *transition = [CATransition animation];
transition.duration = 0.25f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;
[self.selectionImageView.layer addAnimation:transition forKey:nil];
}