Skip to content

Instantly share code, notes, and snippets.


Doug Ilijev dilijev

View GitHub Profile
dilijev /
Created Jun 22, 2017 — forked from esundahl/
Bash Color Test
function color_test {
# Daniel Crisman's ANSI color chart script from
# The Bash Prompt HOWTO: 6.1. Colours
# This function echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
View __tc39-logs-trim.js
// Remove non-chat log lines from e.g.
// paste in debugger console and run, or see for a URL you can add to your favorites bar for the same.
(function () {
function remove(name) {
let elems = document.getElementsByClassName(name);
do {
let e = elems[0];
if (!e) break;
let parent = elems[0].parentNode;
dilijev /
Last active May 31, 2017
Easily set up eshost-cli with public binaries of various JS hosts

This Gist contains sources and instructions for setting up eshost-cli without needing to build anything. (However, some information about where to get sources and how to build is included, if you are so inclined.)

Get eshost-cli

  • npm install -g eshost-cli
  • Run as eshost

(See also eshost)

dilijev /
Last active Mar 10, 2016
Undefined URLs in navigation


  • Edge 25.10586.0.0 and IE on Windows 10 (Version 1511 (OS Build 10586.104)).
  • No repro in Chrome 48
  • No repro in Firefox 44

Repro steps:

  1. Start at URL from list below, e.g.:
  2. Click script directory (or click file, etc.)
dilijev /
Last active Mar 2, 2016
Bash one-liner to find all filetypes in a git repo
git ls-files | grep -P '\/[^\/\.]*\.[^\/\.]+$' | sed -r 's/.*\.([^\/\.]+)$/\1/g' | sort | uniq
dilijev / ansi.cmd
Last active Feb 20, 2016
Demonstrating ANSI color sequences on Windows.
View ansi.cmd
REM the following sets bold red text on grey background, prints ' hello ' and then resets the colors afterwards.
@echo  hello 
dilijev /
Created Sep 13, 2014
Python Batch File Renamer
import re, glob, os
def renamer(files, pattern, replacement):
for pathname in glob.glob(files):
basename= os.path.basename(pathname)
new_filename= re.sub(pattern, replacement, basename)
if new_filename != basename:
os.path.join(os.path.dirname(pathname), new_filename))
dilijev / gist:4576361
Created Jan 20, 2013
Indent open braces, code on the same line as the open brace, further indenting the block, LISP style "if ... else if ... else" hanging indents. I don't even....
View gist:4576361
TOKEN gettoken()
{ int c, cclass;
TOKEN tok = (TOKEN) talloc(); /* = new token */
skipblanks(); /* and comments */
if ((c = peekchar()) != EOF)
cclass = CHARCLASS[c];
if (cclass == ALPHA)
else if (cclass == NUMERIC)
View matrix.cpp
Compile with
g++ matrix.cpp -o matrix
Run with
View DimensionException.cpp
class DimensionException : public std::exception {
size_type _rowsA;
size_type _colsA;
size_type _rowsB;
size_type _colsB;
char _what[256];
: exception() {