Skip to content

Instantly share code, notes, and snippets.

View kanglicheng's full-sized avatar
🦜
LLMs ftw

Stephen Cheng kanglicheng

🦜
LLMs ftw
View GitHub Profile
@gcarrillo
gcarrillo / insertionsort.py
Last active February 16, 2018 19:03
Insertion Sort
#!/usr/bin/env python
'''
Insertion sort
- Best: O(n)
- Average: O(n^2)
- Worst: O(n^2)
'''
def insertionsort(l):
for i in xrange(0, len(l)):
import io
def read_file(file):
"""Return opened file."""
text = []
f = io.open(file, 'r')
for line in f:
if '***' not in line:
text.append(line)
@garyherd
garyherd / simple_caesar_encryption.py
Created March 2, 2016 04:03
Demonstrates Python class inheritance with a simple encryption algorithm
import string
### DO NOT MODIFY THIS FUNCTION ###
def load_words(file_name):
'''
file_name (string): the name of the file containing
the list of words to load
Returns: a list of valid words. Words are strings of lowercase letters.
@mdang
mdang / TECHNICAL_INTERVIEW_PRACTICE.md
Last active August 7, 2025 16:31
Technical Interview Practice

Technical Interview Practice

Behavioral and Informational Questions

Along with deciphering if applicants have the right experience, hiring managers also have to determine if they fit well with the team culturally.

  • Tell me something that's a challenge for you
    • This is a spin on the traditional “what’s your biggest weakness” question, and should be answered carefully. A successful answer demonstrates both self-awareness (where you are challenged) and action (how you are taking steps to improve). A word of caution: don’t respond with a “knock-out” answer that would automatically disqualify you for the job. For example, don’t say you don’t like working in teams in an interview for a leadership position or where performing as part of a team is critical.
  • What tech-related blogs, podcasts, newsletters, etc do you read?
  • Describe a time when you were faced with a stressful situation that demonstrated your coping skills.
@vasanthk
vasanthk / System Design.md
Last active December 3, 2025 19:41
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?

A Few Useful Things to Know about Machine Learning

The paper presents some key lessons and "folk wisdom" that machine learning researchers and practitioners have learnt from experience and which are hard to find in textbooks.

1. Learning = Representation + Evaluation + Optimization

All machine learning algorithms have three components:

  • Representation for a learner is the set if classifiers/functions that can be possibly learnt. This set is called hypothesis space. If a function is not in hypothesis space, it can not be learnt.
  • Evaluation function tells how good the machine learning model is.
  • Optimisation is the method to search for the most optimal learning model.
@KerryJones
KerryJones / selection-sort.py
Last active November 2, 2018 19:33
Python: Selection Sort
##
# Selection Sort
#
# Runtime Complexity: O(n^2)
# Space Complexity: O(1)
##
def selectionSort(arr, detail = False):
for i in range(len(arr)):
min = i
@iamkevinlowe
iamkevinlowe / triplebyte_programming_challenge.rb
Created December 15, 2015 23:22
Triplebyte Programming Challenge
# The first 12 digits of pi are 314159265358. We can make these digits into an expression evaluating to 27182 (first 5 digits of e) as follows:
# 3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182
# or
# 3 + 1 - 415 * 92 + 65358 = 27182
# Notice that the order of the input digits is not changed. Operators (+,-,/, or *) are simply inserted to create the expression.
# Write a function to take a list of numbers and a target, and return all the ways that those numbers can be formed into expressions evaluating to the target. Do not use the eval function in Python, Ruby or JavaScript
@Shanni
Shanni / Links
Last active March 26, 2019 03:28
Hidden Treasures
@tonyfast
tonyfast / conways-game-of-life.ipynb
Last active May 18, 2017 06:23
Conways game of life code kata for PyAtl
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.