Skip to content

Instantly share code, notes, and snippets.

View kenwuuu's full-sized avatar

kenwuuu

View GitHub Profile
@kenwuuu
kenwuuu / SD.md
Created March 13, 2025 17:27 — forked from Neilblaze/SD.md
Standard System Design Interview Approach Template
@kenwuuu
kenwuuu / gist:73c589f9c59a7bf488603839f13ef1c9
Last active February 23, 2025 21:27
brainrot ToS and Privacy Policy
tiktok-developers-site-verification=H74hhs0HCxEj86m5jlIDlQY8B2EZoFrk
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
use rand::seq::SliceRandom;
use std::time::Instant;
// This function takes a query string, a vector of possible queries, and a maximum number of suggestions to return.
// It returns a vector of strings containing all the possible queries that start with the given query string, up to the maximum number of suggestions.
fn autocomplete_fast(query: &str, possible_queries: &[String], max_suggestions: usize) -> Vec<String> {
@kenwuuu
kenwuuu / autocomplete.rs
Last active April 7, 2023 08:47
rust - autocomplete a query against a known list of strings
use std::fs::File;
use std::io::{self, BufRead, BufReader, Write};
use std::time::Instant;
// This function takes a query string, a vector of possible queries, and a maximum number of suggestions to return.
// It returns a vector of strings containing all the possible queries that start with the given query string, up to the maximum number of suggestions.
fn autocomplete_fast(query: &str, possible_queries: &[String], max_suggestions: usize) -> Vec<String> {
// Convert the query string to lowercase.
let query = query.to_lowercase();
@kenwuuu
kenwuuu / ubuntu black screen login.md
Last active January 6, 2021 01:11
black screen login - virtualbox ubuntu vm

ctrl + alt + F5

sudo apt-get clean

sudo apt install --reinstall gdm3 ubuntu-desktop gnome-shell

sudo systemctl reboot

@kenwuuu
kenwuuu / ISO3166.py
Created March 4, 2018 16:28 — forked from carlopires/ISO3166.py
Python dict for ISO3166 country codes
# -o- coding: utf-8 -o-
# ISO3166 python dict
# oficial list in http://www.iso.org/iso/iso_3166_code_lists
ISO3166 = {
'AF': 'AFGHANISTAN',
'AX': 'ÅLAND ISLANDS',
'AL': 'ALBANIA',
'DZ': 'ALGERIA',
'AS': 'AMERICAN SAMOA',