Skip to content

Instantly share code, notes, and snippets.

Often, a duplicate set of either platforms or tracks are needed, because people demand frequent and bi-directional train services:
____▢▢▢> /―――――――――――――――――――――▢▢▢>――――――――――――――― Cityline Eastbound
――<▢▢▢―――< [Riverton] >――――――――――――< [Citycore Sta.] [Findist Sta.]
 ̄ ̄ ̄ ̄ ̄ \―――――<▢▢▢―――――――――――――――――――<▢▢▢―――――― Cityline Westbound
and tracks need regular maintainance, for which sections and lines has to be closed or capacity significantly reduced:
Trolley line ――――――――――▢▢▢▢▢▢>―――――X ඎ ―― ඎ // ඣ X―――――――――――――― Red line
\ [Michael J. Sandel Stadium] / ̄ ̄ ̄ ̄ University North line
@adrienjoly
adrienjoly / format-json-with-nodejs-one-liner.sh
Created June 18, 2020 14:40
A one-line node.js program to format JSON from a stdin stream, to include in bash scripts
$ echo '{"a":1}' \
| node -e \
"d=[];process.openStdin().on('data',c=>d.push(c)).on('end',()=>console.log(JSON.stringify(JSON.parse(d.join('')),null,2)));"
# =>
# {
# "a": 1
# }
@TheJLifeX
TheJLifeX / 00-hand-gesture-recognition.gif
Last active April 18, 2024 21:53
Simple Hand Gesture Recognition Code - Hand tracking - Mediapipe
00-hand-gesture-recognition.gif
@fnky
fnky / ANSI.md
Last active May 24, 2024 11:33
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
import re, sys # this file requires python 3
def parse(tokens):
stack = ([], None)
for t in tokens:
if t == '(':
stack = ([], stack)
elif t == ')':
(finished_list, stack) = stack
stack[0].append(finished_list)
elif not t.startswith(';;'):
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@sj26
sj26 / LICENSE.md
Last active March 8, 2024 18:31
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@mLuby
mLuby / kill-on-port.sh
Created September 2, 2016 21:02
kill processes running on a port
test $(uname) == "Darwin" && lsof -t -i tcp:9001 | xargs kill
test $(uname) == "Linux" && fuser -k 9001/tcp

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@mLuby
mLuby / .eslintrc.json
Last active January 29, 2017 03:58
Comprehensive JS lint file (+ es6, react)
{
"rules": { // And why they're best practice (alphabetized).
"accessor-pairs": [2, {"getWithoutSet": true}], // omission is usually by mistake.
"array-bracket-spacing": 2, // spaces can make arrays take up a lot of space, and concise code allows for more reading context.
"array-callback-return": 2, // omission is usually by mistake.
"arrow-body-style": [2, "as-needed"], // improves consistency and readability.
// "arrow-parens": [2, "as-needed"], // allows for concise arrows while improving consistency.
"arrow-spacing": 2, // improves consistency and readability.
"block-scoped-var": 2, // can behave unexpectedly due to variable hoisting.
"block-spacing": 2, // helps differentiate blocks (spaced) from objects (not spaced).