Skip to content

Instantly share code, notes, and snippets.

uhop /
Created July 3, 2023 19:01 — forked from fnky/
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
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:
# In this guide
View h.mjs
// Copied from under BSD-3 and slightly modified.
// create.js
// Dojo-inspired set of DOM utilities
export const namespaces = {
svg: '',
xlink: '',
ev: '',
xml: ''
uhop / on.mjs
Created May 19, 2023 21:15
The ES6 facelift for the venerable on() from
View on.mjs
// a facelift of the venerable on.js: slightly modified for ES6, removed dead browsers
// copied from, 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.


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.

uhop / print.html
Created April 24, 2023 16:10
Multi-page print test
View print.html
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Multi-page print test</title>
Print to PDF, landscape, letter size, no margins, enable background graphics.
Tested on Chrome.
uhop / str-pad.js
Last active May 16, 2023 14:47
Padding a string: left pad, right pad, repeating a string
View str-pad.js
const rep = (str, n) => {
if (n < 1 || !str) return '';
let result = '';
for (;;) {
if (n & 1) {
result += str;
n >>= 1;
if (n < 1) break;
str += str;
uhop / dnd.js
Last active March 3, 2023 18:34
The facelift of the minimalistic DnD code from
View dnd.js
'use strict';
// from
const noop = () => {};
class DndMove {
static supportedEvents = {
pointerup: 'onPointerUp',
pointermove: 'onPointerMove',
View batch.js
// runs asynchronous operations in parallel, no more than a specified number at a time
// it takes an array of functions, which return promises when invoked without arguments
// modelled after Promise.all()
const wrap = value => {
if (typeof value == 'function') return value();
if (value && typeof value.then == 'function') return value; // thenable
return Promise.resolve(value);
uhop / dnd-g.html
Last active August 3, 2021 23:34
A minimalistic generic DnD code. A facelift of
View dnd-g.html
<!DOCTYPE html>
<title>DnD test bed - grouping</title>
<link rel="stylesheet" href="./dnd.css" />
<h1>DnD test bed - grouping</h1>
<div class="container">
<div class="item dnd-item dnd-handle">One</div>