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 / install-openmp-macos.sh
Created April 6, 2024 03:53 — forked from ijleesw/install-openmp-macos.sh
Install OpenMP on MacOS
#!/bin/bash
# Install
brew install llvm
brew install libomp
# Compile
# clang++ test.cpp -o test -Xpreprocessor -fopenmp -lomp
@kanglicheng
kanglicheng / A-umbrella.md
Created September 7, 2023 17:45 — forked from lubien/A-umbrella.md
Umbrella Challenge

Umbrella Challenge

Given a number of people N and an array of integers, each one representing the amount of people a type of umbrella can handle, output the minimum number of umbrellas needed to handle N people.

No umbrella could have left spaces. Which means if a umbrella can handle 2 people, there should be 2 people under it.

If there's no solution, return -1.

Examples

@kanglicheng
kanglicheng / System Design Techniques.md
Created September 5, 2023 00:40 — forked from nreddy12/System Design Techniques.md
System Design | Techniques To Scale Your System

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?
  • Constraints
    • Mainly identify traffic and data handling constraints at scale.
    • Scale of the system such as requests per second, requests types, data written per second, data read per second)
@kanglicheng
kanglicheng / system-design.md
Created September 5, 2023 00:40 — forked from ayhansipahi/system-design.md
system design

1. High-Level Design

Key Components

The key components of the system are:

  1. Frontend: The web and mobile applications that users interact with to select and navigate routes.
  2. Backend API: The API that provides the predefined routes to the frontend and stores completed routes for users.
  3. User service: The service that handles user operations. Such as following and viewing other users and modifying user profiles
  4. Route service: The service that handles route operations. Such as creating, updating, and deleting routes.
  5. Real-time location tracking service: The service that tracks the position of other users navigating the same route in real-time.
@kanglicheng
kanglicheng / david-shariff-js-quiz-explanation.md
Created January 23, 2023 06:03 — forked from jesspoemape/david-shariff-js-quiz-explanation.md
An explanation of David Shariff's Javascript quiz
@kanglicheng
kanglicheng / main.go
Created January 22, 2023 05:49 — forked from unixpickle/main.go
Jane Street problem
// Solves this problem: http://1mage.us/1339.
package main
import (
"fmt"
"math"
"math/rand"
"sort"
@kanglicheng
kanglicheng / almost_magic.py
Created January 22, 2023 05:49 — forked from qubard/almost_magic.py
jane street almost magic
import z3
def add_constraints(s, inp):
for digit in inp:
s.add(digit > 0)
s.add(digit < 200)
b = [(6,10,11),(9,12,13),(15,16,17),(6,9,15),(10,12,16),(11,13,17), (6,12,17),(11,12,15)]
a = [(1,2,3),(4,5,6),(7,8,9),(1,4,7),(2,5,8),(3,6,9), (1,5,9),(3,5,6)]
c = [(18,7,8),(19,20,14),(21,22,23),(18,19,21),(7,20,22),(8,14,23), (18,20,23),(21,20,8)]
@kanglicheng
kanglicheng / Build-tools.md
Created January 22, 2023 05:49
OCaml User Survey 2020 - Replies to free-form questions

OCaml build tools: What would you change?

Having a coherent OCaml toolchain distribution.

Improve cross compilation experience

Improve docs

more integration, e.g. Rust's cargo style

Learn functional programming with the OCaml programming language

Registrations are open!

Functional programming is attracting interest from a broad range of developers because it allows to write expressive, concise and elegant programs.

The course "Introduction to Functional programming using the OCaml language" introduces gradually the central notions of functional programming, via a set of video courses that are complemented by a