Skip to content

Instantly share code, notes, and snippets.

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
tscholl2 /
Last active Mar 29, 2017
most used characters in some files
cat *.go | python3 -c "from sys import stdin;a=[c for c in 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 /
Created Apr 19, 2017
TeX'd graphs in sage
import matplotlib.pyplot as plt
plt.rc('text', usetex=True)
plt.rc('font',**{'family':'serif','serif':['Computer Modern Roman'],'size':14})
tscholl2 / Dockerfile
Last active Apr 8, 2019
Dockerfile for TexStudio
View Dockerfile
FROM debian:stretch
# setup: language and ensure that external fonts and doc folders exists
RUN export LANG=C.UTF-8 &&\
mkdir -p /usr/share/fonts/external/ &&\
mkdir /doc/
# install utilities, texlive, ghostscript, and remove unused docs
RUN apt-get clean &&\
apt-get update &&\
tscholl2 / index.html
Last active Aug 31, 2017
caching and promis-ing in hyperapp
View index.html
<script src=""></script>
<script src="main.js"></script>
tscholl2 / .bashrc
Last active Sep 7, 2019
vscode settings
View .bashrc
# Color prompt
PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h\[\033[1;31m\]:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '
## Colorize the ls output
alias ls='ls --color=auto'
View profile.sage
E = EllipticCurve_from_j(GF(127)(1728))
g = E.plot(size=25,aspect_ratio=1)"./F_127 j_1728.svg")
tscholl2 / Dockerfile
Last active Jan 19, 2018
sage in docker with extras
View Dockerfile
FROM sagemath/sagemath:8.0-2
RUN echo && \
# update system
apt-get update && apt-get install -y && \
# install some dependencies for gifs and animations
apt-get install -y imagemagick ffmpeg && \
# install tex
tscholl2 / aes.go
Last active Jul 21, 2022
simple AES encryption/decryption example with PBKDF2 key derivation in Go, Javascript, and Python
View aes.go
package main
import (
tscholl2 / controller.min.js
Last active Jul 5, 2019
another redux-ish C in MVC
View controller.min.js
var Controller=function(){return function(t){var n=this;this.p=[],this.l=[],this.getState=function(){return n.s},this.addPlugin=function(t){n.p.push(t)},this.removePlugin=function(t){n.p=n.p.filter(function(n){return n!==t})},this.addListener=function(t){n.l.push(t)},this.removeListener=function(t){n.l=n.l.filter(function(n){return n!==t})},this.dispatch=function(t){n.p.forEach(function(n){return t=n(t)});var i=t(n.s);n.s!==i&&(n.s=i,n.l.forEach(function(t){return t(n.s,n.dispatch)}))},this.s=t}}();