Skip to content

Instantly share code, notes, and snippets.

@sushlala
sushlala / System Design.md
Created April 29, 2020 18: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?
@sushlala
sushlala / simplest-syslog-server.sh
Created December 3, 2019 02:21
The simplest syslog server using netcat
nc -kluvw 0 0.0.0.0 514
// Mgmt
// Copyright (C) 2013-2018+ James Shubin and the project contributors
// Written by James Shubin <james@shubin.ca> and the project contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
@sushlala
sushlala / .vimrc
Created January 23, 2019 00:16 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@sushlala
sushlala / strtok.c
Created December 21, 2017 05:21
An implementation of strtok
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
bool is_delim(char c, char *delim)
{
while(*delim != '\0')
{
if(c == *delim)
return true;
@sushlala
sushlala / trie.py
Created September 24, 2017 04:28
a trie implemented in Python
from itertools import islice
from collections import defaultdict
from Queue import Queue
class Node(object):
'A node in our trie. Only nodes at which a key end will have a `val` attribute'
__slots__ = ('children', 'val')
def __init__(self):
self.children = defaultdict(self.__class__)
@sushlala
sushlala / hashtable.c
Last active October 12, 2015 18:43
A simple hash table in c
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
struct hash_table_entry
{
char *key;
char *value;
struct hash_table_entry *next;