Skip to content

Instantly share code, notes, and snippets.

@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}
@lambdaydoty
lambdaydoty / bridge_host_tunnel_to_container.sh
Created July 8, 2020 02:27
How to access host port from a docker container
## `How to access host port from a docker container`
## `Access host's ssh tunnel from docker container`
## `Prevent from using --net=host`
## ...
# +-------------------+
# | |
# | |
# | local container |
# | +---+
# +-------------------+ |172.10.0.1
;(function () {
const { S, F } = require ('./src/utils/sanctuary') ()
const control = F.coalesce (_ => S.Nothing) (S.Just)
const fut = F.go (function * () {
// const book1 = yield F.resolve ('Python')
const book1 = yield control (F.reject ('?network error'))
const book2 = yield control (F.resolve ('JavaScript'))
return {
book1,
book2,