Skip to content

Instantly share code, notes, and snippets.

View kanglicheng's full-sized avatar
🦜
LLMs ftw

Kang-Li (Stephen) Cheng kanglicheng

🦜
LLMs ftw
View GitHub Profile
@kanglicheng
kanglicheng / MongoDB_macOS_Sierra.md
Created April 22, 2019 03:32 — forked from nrollr/MongoDB_macOS_Sierra.md
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@kanglicheng
kanglicheng / karat.py
Last active June 10, 2019 04:08
zume interview 2nd round
# Given a board and an end position for the player, write a function to determine if it is possible to travel from every open cell on the board to the given end position.
board1 = [
[ 0, 0, 0, 0, -1 ],
[ 0, -1, -1, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, -1, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
@kanglicheng
kanglicheng / System Design.md
Created May 14, 2019 17:29 — 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?
@kanglicheng
kanglicheng / DistBelief.md
Created May 14, 2019 17:29 — forked from shagunsodhani/DistBelief.md
Notes for "Large Scale Distributed Deep Networks" paper

Large Scale Distributed Deep Networks

Introduction

  • In machine learning, accuracy tends to increase with an increase in the number of training examples and number of model parameters.
  • For large data, training becomes slow on even GPU (due to increase CPU-GPU data transfer).
  • Solution: Distributed training and inference - DistBelief
  • Link to paper

DistBelief

Papers

This list is adapted from the lecture plan for the "Advanced Topics in Computer Systems" course at Berkeley, which is available here: https://people.eecs.berkeley.edu/~kubitron/cs262/index_lectures.html

Thanks to Anthony Joseph and John Kubiatowicz for putting the original list together.

Introduction to the course, some basic philosophy, UNIX system.

@kanglicheng
kanglicheng / django_python_interview_questions.md
Created May 16, 2019 05:19 — forked from subhajeet2107/django_python_interview_questions.md
Simple Interview questions for Django Developer

Django/Python Questions

  1. Find the most frequent integer in a list, Test list : [3,5,6,3,9,0,3,8,3,1,3]

  2. Find the common elements of 2 lists

        a = [2,3,4,1,1,3,6]
        b = [2,8,9,1,3]
@kanglicheng
kanglicheng / migrations.md
Created May 16, 2019 05:35 — forked from majackson/migrations.md
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@kanglicheng
kanglicheng / README.md
Created May 19, 2019 23:36 — forked from joyrexus/README.md
The Stable Marriage Problem

My implementation of the Gale/Shapley algorithm in Python. This algorithm is designed to address the Stable Marriage Problem.

Compare this recursive variant with the implementations on Rosetta Code.

Problem description

Given an equal number of men and women to be paired for marriage, each man ranks all the women in order of his preference and each women ranks all the men in order of her preference.

A stable set of engagements for marriage is one where no man prefers a women over the one he is engaged to, where that other woman also prefers that man over the one she is engaged to. I.e. with consulting marriages, there would be no reason for the engagements between the people to change.

@kanglicheng
kanglicheng / gist:1f96d3fccac4a212192f668c73c7d73d
Created June 6, 2019 21:27 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@kanglicheng
kanglicheng / migrate_postgresql_database.md
Created June 27, 2019 20:59 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important: