Skip to content

Instantly share code, notes, and snippets.

@tscholl2
tscholl2 / most-used-characters.sh
Last active March 29, 2017 23:02
most used characters in some files
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 March 20, 2017 18:07
find some cycles in typescript imports
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
*/