Skip to content

Instantly share code, notes, and snippets.

View kevinfiol's full-sized avatar
🤖
replaced by AI

kevinfiol

🤖
replaced by AI
View GitHub Profile
@kevinfiol
kevinfiol / fingerprints.md
Last active February 1, 2026 04:30
firefox configs

image

services:
postgres:
image: docker.io/library/postgres:16.10-alpine3.22
restart: always
ports:
- "5433:5432"
environment:
POSTGRES_USER: kevin
POSTGRES_PASSWORD: hunter2
POSTGRES_DB: postgres
[
{
// if you want this to work with Windows Terminal, WT must be configured to have default dir to be "%__CD__%"
"key": "alt+`",
"command": "workbench.action.terminal.openNativeConsole",
"when": "!terminalFocus"
},
{
"key": "ctrl+alt+p",
"command": "workbench.action.openRecent"
@kevinfiol
kevinfiol / js.md
Last active February 8, 2025 18:36
  1. How would you attain a reference to a DOM node on the page with the id, 'foo', without using jQuery?

    • document.getElementById('foo') or document.querySelector('#foo')
  2. How would you make a request to an API endpoint without jQuery?

    • use the fetch API, like fetch('/my/url')
    • or, old-school, use XMLHttpRequest:
    var req = new XMLHttpRequest();

req.open('GET', '/my/url');

@kevinfiol
kevinfiol / mouse.kbd
Created December 26, 2024 21:12
kanata config for mousebtn + scrollwheel
;; keys here https://github.com/jtroo/kanata/blob/main/parser/src/keys/mod.rs
(defcfg
process-unmapped-keys yes
)
(deflocalkeys-linux
mouseside1 275
)
@kevinfiol
kevinfiol / cmus.desktop
Created November 5, 2024 19:58
custom .desktop files
[Desktop Entry]
Name=cmus
Exec=alacritty --hold --class cmus --title cmus --command cmus
Terminal=false
Type=Application
Icon=/home/kevin/.local/share/applications/cmus.svg
StartupNotify=
StartupWMClass=
X-AppImage-Version=
Comment=

Solutions

Arrays

Guide

  • Advantages: Store multiple elements, accessing elements is fast with index
  • Disadvantages: Adding/removing in the middle is slow because items must be shifted; act of copying new array is O(n) because everything must be iterated over

Be mindful about slicing or concatenating arrays in your code. Typically, slicing and concatenating arrays would take O(n) time. Use start and end indices to demarcate a subarray/range where possible.

@kevinfiol
kevinfiol / foo.js
Last active July 23, 2024 17:09
karat
/*
Our local radio station is running a show where the songs are ordered in a very specific way. The last word of the title of one song must match the first word of the title of the next song - for example, "Silent Running" could be followed by "Running to Stand Still". No song may be played more than once.
Given a list of songs and a starting song, find the longest chain of songs that begins with that song, and the last word of each song title matches the first word of the next one. Write a function that returns the longest such chain. If multiple equivalent chains exist, return any of them.
Example:
songs1 = [
"Down By the River",
"River of Dreams",
"Take me to the River",
[
{ "keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index" : 0} },
{ "keys": ["ctrl+alt+`"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{ "keys": ["alt+`"], "command": "open_terminal_project_folder" },
{ "keys": ["ctrl+`"], "command": "open_terminal_project_folder" },
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" },
{ "keys": ["alt+right"], "command": "auto_complete_open_link", "context":
[
{ "key": "auto_complete_visible", "operator": "equal", "operand": true },
]