Skip to content

Instantly share code, notes, and snippets.

@uhop
uhop / dll.js
Last active July 27, 2024 19:30
Minimal circular SLL and DLL (lists).
// doubly linked list
const removeNode = node => {
node.prev.next = node.next;
node.next.prev = node.prev;
node.prev = node.next = node;
return node;
};
class DLL {
@uhop
uhop / min-heap-ext.js
Last active July 27, 2024 16:21
Minimal min-heap
import {up, down} from './min-heap.js';
// more efficient operations based on up() and down()
// WARNING: untested (if I wrote comprehensive tests it wouldn't be a gist, would it?)
const replaceTop = (heapArray, value, less) => {
const top = heapArray[0];
heapArray[0] = value;
down(heapArray, 0, less);
return top;

Shell scripting with Markdown documents

alias ~~~=":<<'~~~sh'";:<<'~~~sh'

@uhop
uhop / LC_COLORS.md
Created March 23, 2024 05:28 — forked from thomd/LC_COLORS.md
LSCOLORS & LS_COLORS

alternatively use: http://geoff.greer.fm/lscolors/

LSCOLORS

The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.

The color designators are as follows:

a black

@uhop
uhop / 0.README.md
Created March 22, 2024 18:22 — forked from izabera/0.README.md
tput codes

This is the table from man 5 terminfo.

Do NOT hardcode terminal escape sequences. Use tput with the cap-names from the table below to get the right code for your terminal.

(P) indicates that padding may be specified
@uhop
uhop / ANSI.md
Created July 3, 2023 19:01 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@uhop
uhop / README
Created May 29, 2023 06:35 — forked from radfish/README
Route only Transmission through a VPN connection using your own VPN server
# The approach is to mark packets from a specific user,
# create a dedicated routing table with a default route
# through the VPN, and force all marked packets to be
# routed using that table.
#
# Sources:
# https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface/
# http://freeaqingme.tweakblogs.net/blog/9340/netflix-using-a-vpn-for-just-one-application.html
# In this guide
// Copied from https://github.com/heya/dom under BSD-3 and slightly modified.
// create.js
// Dojo-inspired set of DOM utilities
export const namespaces = {
svg: 'http://www.w3.org/2000/svg',
xlink: 'http://www.w3.org/1999/xlink',
ev: 'http://www.w3.org/2001/xml-events',
xml: 'http://www.w3.org/XML/1998/namespace'
@uhop
uhop / on.mjs
Created May 19, 2023 21:15
The ES6 facelift for the venerable on() from https://github.com/clubajax/on
// a facelift of the venerable on.js: slightly modified for ES6, removed dead browsers
// copied from https://github.com/clubajax/on, used under the MIT license
// internal utilities
const getNodeById = id => {
const node = document.getElementById(id);
if (!node) {
console.error('`on` Could not find:', id);
}

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.