Skip to content

Instantly share code, notes, and snippets.

@tscholl2
tscholl2 / most-used-characters.sh
Last active Mar 29, 2017
most used characters in some files
View most-used-characters.sh
cat *.go | python3 -c "from sys import stdin;a=[c for c in stdin.read() if c.strip() != ''];b=[(a.count(c),c) for c in set(a)];b.sort();b.reverse();print('\n'.join(map(lambda x: '%d\t%s'%x,b)))"
@tscholl2
tscholl2 / importCycles.js
Created Mar 20, 2017
find some cycles in typescript imports
View importCycles.js
const fs = require('fs');
const path = require('path');
const entry = path.resolve(process.argv.slice(2)[0]) || './index.ts';
const entryPath = path.dirname(entry);
/**
* Tries to find all imported file names in given file.
* @param {string} fileName
* @returns {string[]} importedFiles
*/