This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn pow [x n] | |
"x^n" | |
(if (>= n 0) | |
(->> x (repeat n) (reduce *)) | |
(->> (pow (/ 1 x) (- n))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# Simple script that prints out the top N most-used words in a text from standard input. | |
# | |
# Inspired by https://buttondown.email/hillelwayne/archive/donald-knuth-was-framed/. The short | |
# linux script is first shown at https://www.cs.tufts.edu/~nr/cs257/archive/don-knuth/pearls-2.pdf | |
topw() { | |
tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed "$N"q | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.TH "LOVE" "1" "Love User Manuals" "Fernando Barbosa" "FEBRUARY 2020" | |
.SH NAME | |
.PP | |
love \- baby don't hurt me, don't hurt me, no more | |
.SH AUTHOR | |
.PP | |
Fernando Barbosa (mail@fdr.one) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: gitbig N - returns the N biggest git refs (default N is 10). | |
# | |
# Note that to remove these refs you will need to rewrite the | |
# commit history. See https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html | |
# for more information. | |
if (( `find .git/objects/pack -name *.idx | wc -l` > 1 )); then | |
git gc --aggressive --prune=now | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "$1" | python -m json.tool |