Skip to content

Instantly share code, notes, and snippets.

Brian Schlenker bschlenk

Block or report user

Report or block bschlenk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bschlenk / png2console
Created Aug 5, 2019
Generate a node.js script that prints an image to the console using chalk. Requires pillow.
View png2console
#!/usr/bin/env python3
import sys
from itertools import islice
from PIL import Image
PIXEL = '▄'
# The amount an image needs to be scaled to look good in terminal
TERM_RATIO = 0.8276
bschlenk / sortBy.js
Created Jun 1, 2019
A function to easily sort JS objects by key.
View sortBy.js
* Create a sorting function that can sort objects by a calculated key. Can be passed to `Array.sort`.
* @param cb A function that will be passed each object and expected to return a key to sort by.
* The key can be either a string, number, or an array of those.
* @return A function that can be passed to `Array.sort`.
function sortBy(cb) {
const stringCompare = (a, b) => a.localeCompare(b);
const numberCompare = (a, b) => a - b;
bschlenk / color.ts
Last active Mar 2, 2018
typeorm @BeforeInsert repro
View color.ts
import {
} from 'typeorm';
import Picture from './picture';
bschlenk /
Created Jan 28, 2017
Generate all possible truth table combinations for the given number of inputs. Wrote for students in logic class.
#!/usr/bin/env python
import sys
if len(sys.argv) != 2:
print "usage: %s <number of inputs>" % sys.argv[0]
inputs = int(sys.argv[1])
rows = 2 ** inputs
bschlenk / say.js
Last active Mar 23, 2018
Call macOS's "say" program with every possible voice at the same time with the given phrase.
View say.js
#!/usr/bin/env node
* Call macOS's `say` program with every possible voice at the same
* time with the given phrase. Scare your pets.
const { exec } = require('child_process');
function getVoices(callback) {
bschlenk /
Created Dec 26, 2016
Reorganize a directory into subfolders the same way git organizes its object files.
#!/usr/bin/env python3
Reduce the size of a directory by creating new directories for each
unique combination of the first two letters of the existing files.
This is the same way that git stores object files.
For example, a file with this name would result in the following:
bschlenk / hideit.user.js
Last active Mar 4, 2018
Hide any element on the page by meta+alt clicking it. Return the page to normal by shift+meta+alt clicking.
View hideit.user.js
// ==UserScript==
// @name HideIt
// @namespace
// @version 1.1.2
// @description Hide any element on the page, with the ability to restore all.
// @author Brian Schlenker <>
// @match *://*/*
// @noframes
// ==/UserScript==
bschlenk /
Last active Mar 3, 2017 — forked from Natim/
Convert an ini configuration file into a json file. Retains original order of ini file entries and prints json out with four space indentation.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
from collections import OrderedDict
from ConfigParser import (ConfigParser, MissingSectionHeaderError,
ParsingError, DEFAULTSECT)
You can’t perform that action at this time.