Skip to content

Instantly share code, notes, and snippets.

View dilijev's full-sized avatar

Doug Ilijev dilijev

View GitHub Profile
@dilijev
dilijev / color_test.sh
Created June 22, 2017 18:53 — forked from esundahl/color_test.sh
Bash Color Test
function color_test {
# Daniel Crisman's ANSI color chart script from
# The Bash Prompt HOWTO: 6.1. Colours
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# 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
@dilijev
dilijev / __tc39-logs-trim.js
Last active May 11, 2017 21:23
Remove non-chat log lines from e.g. http://logs.libuv.org/tc39/latest
// Remove non-chat log lines from e.g. http://logs.libuv.org/tc39/latest
// paste in debugger console and run, or see _bookmarklet.md 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;
parent.removeChild(e);
@dilijev
dilijev / js-host-bin-sources.md
Last active May 31, 2017 01:04
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.)

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

(See also eshost)

@dilijev
dilijev / repro.md
Last active March 10, 2016 23:49
Undefined URLs in navigation

Affects:

  • 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.: https://github.com/defunkt/jquery-pjax
  2. Click script directory (or click CONTRIBUTING.md file, etc.)
@dilijev
dilijev / filetypes.sh
Last active March 2, 2016 01:03
Bash one-liner to find all filetypes in a git repo
git ls-files | grep -P '\/[^\/\.]*\.[^\/\.]+$' | sed -r 's/.*\.([^\/\.]+)$/\1/g' | sort | uniq
@dilijev
dilijev / ansi.cmd
Last active February 20, 2016 00:30
Demonstrating ANSI color sequences on Windows.
REM the following sets bold red text on grey background, prints ' hello ' and then resets the colors afterwards.
@echo  hello 
@dilijev
dilijev / renamer.py
Created September 13, 2014 23:11
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.rename(
pathname,
os.path.join(os.path.dirname(pathname), new_filename))
@dilijev
dilijev / gist:4576361
Created January 20, 2013 02:40
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....
TOKEN gettoken()
{ int c, cclass;
TOKEN tok = (TOKEN) talloc(); /* = new token */
skipblanks(); /* and comments */
if ((c = peekchar()) != EOF)
{
cclass = CHARCLASS[c];
if (cclass == ALPHA)
identifier(tok);
else if (cclass == NUMERIC)
/**
Compile with
g++ matrix.cpp -o matrix
Run with
./matrix
*/
@dilijev
dilijev / DimensionException.cpp
Created October 21, 2012 06:25
DimensionException
class DimensionException : public std::exception {
private:
size_type _rowsA;
size_type _colsA;
size_type _rowsB;
size_type _colsB;
char _what[256];
public:
DimensionException()
: exception() {