Skip to content

Instantly share code, notes, and snippets.

View jadbox's full-sized avatar

Jonathan Rose Dunlap jadbox

View GitHub Profile
@jadbox
jadbox / auth.service.ts
Created July 13, 2018 20:55 — forked from 509dave16/auth.service.ts
Auth Service for Gun.js
import { gun } from './gun.service';
export const STATUS_SUCCESS = 'success';
export const STATUS_ERROR = 'error';
const ACTION_CREATE = 'create';
const ACTION_AUTH = 'auth';
const SESSION_KEY_USERNAME = 'rt_username';
const SESSION_KEY_PASSWORD = 'rt_password';
export interface Credentials {
username: string;
@jadbox
jadbox / gist:c8379b023cc2cebcea4d28cde84feb9f
Created March 23, 2017 00:44 — forked from BenderV/gist:44901bac756ff3b8279d018eb1e2cc1f
#Podcast Knowledge Project: Naval Ravikant
Just do something, doesn't matters what
Book == blog archives. Feel free to scram
We are creatures of habits (but don't condition habits with identity/ego). Have deliberate habits
Stopping alcohol
Unpack causes
- availability
- desire
Availability => Early morning sport. Force to not go out at night too much.
Desire
@jadbox
jadbox / latency.markdown
Created October 8, 2016 22:06 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@jadbox
jadbox / gist:0d25accd3d752ad6fb99dee3a3a83ae8
Created July 27, 2016 00:40
Macbook Pro Retina 11,2 -- Debian Jessie 8.0 Installation

OS and i3

  • Debian Jessie (8.0) Minimal Installation
  • Guided partitioning
  • Only enable system utilities, disable Debian Desktop Environment and Print Server

Login as root

apt-get install sudo
adduser <youruser> sudo
@jadbox
jadbox / gist:ae3065eb348b77e8bbcf94cc7181d04d
Created June 25, 2016 19:07 — forked from ralph-tice/gist:c2943aa672aaa65ecb59
PostgreSQL settings to aggressively vacuum, this config was used for an 18000 TPS steadystate workload on i2.xlarge
#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------
#autovacuum = on # Enable autovacuum subprocess? 'on'
# requires track_counts to also be on.
log_autovacuum_min_duration = 0 # -1 disables, 0 logs all actions and
# their durations, > 0 logs only
# actions running at least this number
# of milliseconds.
import {Stream} from 'most'
const fromNodeCallBack = fn => (...args) => new Stream(new CallBackSource(fn, args))
class CallBackSource {
constructor (fn, args) {
this.fn = fn
this.args = args
}
@jadbox
jadbox / System Design.md
Created April 19, 2016 04: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?
@jadbox
jadbox / .git-commit-template.txt
Created March 10, 2016 23:28 — forked from adeekshith/.git-commit-template.txt
A Git commit template to make it easy to enforce a good and uniform commit message style across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@jadbox
jadbox / render-react-with-rxjs.md
Last active August 26, 2015 18:28 — forked from zxbodya/render-react-with-rxjs.md
React with RxJS, reactive way :)

Observable React elements with RxJS

When I just started using RxJS with React, I was subscribing to observables in componentDidMount and disposing subscriptions at componentWillUnmount.

But, soon I realised that it is not fun to do all that subscriptions(that are just updating property in component state) manually, and written mixin for this...

Later I have rewritten it as "high order component" and added possibility to pass also obsarvers that will receive events from component.

But, shortly after, I realised that for server side rendering, I need to do something quite complicated(in order to wait until all data would be loaded, before rendering - actually, I was building an isomorphic application, and still working on it).

#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal