Skip to content

Instantly share code, notes, and snippets.

public class Main {
public static void main(String[] args) {
System.out.println("License Plates Generator");
System.out.println(gen(3));
System.out.println(gen(10000));
System.out.println(gen(9000_00));
}
private static String gen(int n) {
// [0,100_000) -> "" ... 100_000
@lambdaydoty
lambdaydoty / CircularBuffer.java
Created May 2, 2025 23:22
Circular Buffer with Concurrency
public class CircularBuffer<T> {
private final T[] buffer;
private int head = 0;
private int tail = 0;
private int size = 0;
private final int capacity;
public CircularBuffer(int capacity) {
this.capacity = capacity;
buffer = (T[]) new Object[capacity];
@lambdaydoty
lambdaydoty / PriorityFirstSearch.java
Created December 27, 2024 02:57
A priority first search unifying the four classical search algorithms: DFS, BFS, Dijkstra's shortest path, Prim's minimum spanning tree
import java.util.*;
import java.util.function.*;
class PriorityFirstSearch {
private final int N = 100;
private int _tick = 0;
private void byPFS(char src) {
/**
* To emcompass all four kinds of search (dfs, bfs, dijkstra, prim),
@lambdaydoty
lambdaydoty / general.md
Last active February 15, 2022 08:28
gtel-tpkd-cheatsheets

readline/emacs


[c-a] .                 . [c-e]
[a-b]    .         .      [a-f]
[c-b]    |   . .   |      [c-f]
         |   |_|   |
    $ cp monfichier dir/
 | ^ | [c-d]
sudo apt-get update

# zsh, oh-my-zsh, zplug
sudo sed -i 's/required/sufficient/g' /etc/pam.d/chsh  # env: `gcp vm`
sudo apt-get install -y git wget zsh && \
  chsh -s $(which zsh) && \
  sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" && \
  (curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh)
mv ~/.zshrc{,.bak}
@lambdaydoty
lambdaydoty / copy-repo.md
Created December 14, 2021 14:23
Copy a repo without forking

How to copy a GitHub repo without forking

GitHub only lets you fork a repo once, if you want to make more than one copy of a project here's how you can do it. Useful for starter code.

  1. Create a new empty folder for your project and initialize git

    cd where-you-keep-your-projects

mkdir your-project-name

@lambdaydoty
lambdaydoty / 01.bash_shortcuts_v2.md
Created December 6, 2021 03:23 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@lambdaydoty
lambdaydoty / gist:eef96c887c090bccb80bc764e3e7a0fb
Created November 26, 2021 12:22 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
; RenZkeys - developer-productivity key bindings for AutoHotkey
; Author: Matthew Renze
; Purpose: To maximize your keyboard productivity by minimizing the number of times your fingers leave the home row for text navigation, selection, and deletion
; Based on Vonmacs by Jon von Gillern
; For more information, please visit my github repo:
; https://github.com/matthewrenze/ren-z-keys
;Character-level Text Navigation
!k::Send {Up}
!j::Send {Down}