Skip to content

Instantly share code, notes, and snippets.

@elevine
elevine / System Design.md
Created October 21, 2021 17:24 — 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?
@elevine
elevine / keybase.md
Created January 25, 2017 14:40
keybase.md

Keybase proof

I hereby claim:

  • I am elevine on github.
  • I am elevine (https://keybase.io/elevine) on keybase.
  • I have a public key whose fingerprint is DCD2 0A60 277B 69D8 3E64 AEA5 4654 D0CC 1229 1B56

To claim this, I am signing this object:

@elevine
elevine / react-virtualized.js
Created January 20, 2017 16:55
Jest mock for the react-virtualized AutoSizer component
// __mocks__/react-virtualized.js
// note - at the top of your test file, include this line: jest.mock('react-virtualized');
import React from 'react';
const reactVirtualized = jest.genMockFromModule('react-virtualized');
const autoSizerProps = {
height: 100,
width: 100
}
@elevine
elevine / index_markercluster.html
Last active September 26, 2016 17:07
Realtime Dyamic Leaflet MarkerCluster
<head>
<style>
#map {
height: 100vh;
width: 100vw;
padding: 0px;
margin: 0px;
background: white;
}
var fs fileSystem = osFS{}
type fileSystem interface {
Open(name string) (file, error)
Stat(name string) (os.FileInfo, error)
}
type file interface {
io.Closer
io.Reader
@elevine
elevine / AES-CTR-256-Example.cs
Created April 14, 2016 20:00 — forked from beveradb/AES-CTR-256-Example.cs
Example AES CTR 256 bit encryption with no IV in C#
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.Encoders;
using System;
using System.Globalization;
using System.Security.Cryptography;
@elevine
elevine / cb_sync_gateway_logger.js
Created February 18, 2016 20:52
Script to try and record the time it takes for documents to be synced by the Sync Gateway
var WebSocket = require('ws');
var ws = new WebSocket('ws://<server-address>:4984/db/_changes?feed=websocket');
var messageCount = 0;
var totalTime = 0;
var wsOptions = {
include_docs : true,
channels : "test",
filter: "sync_gateway/bychannel",
@elevine
elevine / log.txt
Created February 18, 2016 20:42
Long sync time observed from Couchbase SG
2016-02-18T20:38:45.576Z HTTP: #112: POST /db/
2016-02-18T20:38:45.576Z CRUD+: Invoking sync on doc "c083cf30e4310ab077fd83817a
d1ac5e" rev 1-7c6d146555aa7504a98225935c0ee91d
2016-02-18T20:38:45.577Z CRUD: Doc "c083cf30e4310ab077fd83817ad1ac5e" in channe
ls "{test}"
2016-02-18T20:38:45.578Z Cache: SAVING #83
2016-02-18T20:38:45.578Z CRUD: Stored doc "c083cf30e4310ab077fd83817ad1ac5e" / "
1-7c6d146555aa7504a98225935c0ee91d"
2016-02-18T20:38:45.579Z HTTP+: #112: --> 200 (4.0 ms)
2016-02-18T20:38:50.084Z Cache: Received #83 after 4505ms ("c083cf30e4310ab077fd
@elevine
elevine / consumer.js
Last active February 18, 2016 20:18
Sync Gateway Websocket Consumer and Producer
var WebSocket = require('ws');
var ws = new WebSocket('ws://server-address-here:4984/db/_changes?feed=websocket');
ws.onopen = function() {
console.log("Open");
};
ws.onmessage = function(data, flags) {
console.log("on message");
};
@elevine
elevine / The Technical Interview Cheat Sheet.md
Last active August 25, 2015 19:38 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.