Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jerry-sl
jerry-sl / System Design.md
Created March 5, 2019 16:50 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@jerry-sl
jerry-sl / .bashrc
Created June 23, 2018 06:30 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@jerry-sl
jerry-sl / gox.text
Created June 18, 2018 05:49 — forked from achun/gox.text
go get golang.org/x
go get -u golang.org/x/crypto/bcrypt
go get -u golang.org/x/crypto/blowfish
go get -u golang.org/x/crypto/bn256
go get -u golang.org/x/crypto/cast5
go get -u golang.org/x/crypto/curve25519
go get -u golang.org/x/crypto/hkdf
go get -u golang.org/x/crypto/md4
go get -u golang.org/x/crypto/nacl/box
go get -u golang.org/x/crypto/nacl/secretbox
go get -u golang.org/x/crypto/ocsp
@jerry-sl
jerry-sl / random.md
Created June 3, 2018 08:51 — forked from joepie91/random.md
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@interface ApplicationDelegate<UIApplicationDelegate>
@end
@implementation ApplicationDelegate
- (RACSignal *)rac_registeredForRemoteNotifications {
RACSignal *signal = objc_getAssociatedObject(self, _cmd);
if (signal != nil) return signal;
RACSignal *didRegisterForRemoteNotification = [[self rac_signalForSelector: @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) fromProtocol: @protocol(UIApplicationDelegate)] map: ^(RACTuple *tuple) {
return tuple.second;
typedef enum {
AGCommandPriorityLow = -10,
AGCommandPriorityDefault = 0,
AGCommandPriorityHigh = 10
} AGCommandPriority;
@interface AGCommand : NSObject
@property(nonatomic, weak) NSObject *firingObject;
@property(nonatomic, readonly) SEL action;
typedef enum {
AGCommandPriorityLow = -10,
AGCommandPriorityDefault = 0,
AGCommandPriorityHigh = 10
} AGCommandPriority;
@interface AGCommand : NSObject
@property(nonatomic, weak) NSObject *firingObject;
@property(nonatomic, readonly) SEL action;
#import <UIKit/UIKit.h>
@interface DateFlowLayout : UICollectionViewFlowLayout
@end