Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
jonschlinkert / markdown-toc_repeated-headings.md
Created December 15, 2015 19:42
Example table of contents generated by markdown-toc, correctly links repeated headings.
@bishboria
bishboria / springer-free-maths-books.md
Last active May 10, 2025 04:28
Springer made a bunch of books available for free, these were the direct links
@claymcleod
claymcleod / pycurses.py
Last active April 28, 2025 17:11
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@Gabrielgtx
Gabrielgtx / PKGBUILD duolingo
Last active November 6, 2021 17:54
Unofficial release of Duolingo for Linux / Learn languages by playing a game. It's 100% free, fun, and scientifically proven to work. / https://www.duolingo.com/
pkgname=duolingo
pkgver=0.3.1
pkgrel=1
pkgdesc="Unofficial release of Duolingo for Linux / Learn languages by playing a game. It's 100% free, fun, and scientifically proven to work."
url="https://www.duolingo.com/"
arch=('x86_64')
license=('custom')
install=duolingo.install
source=("https://github.com/mikethedj4/duolingo-linux/raw/master/${pkgname}-linux.tar.gz"
"duolingo.desktop")

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@eguven
eguven / brew-list.sh
Last active April 13, 2025 05:34
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
@ipbastola
ipbastola / jq to filter by value.md
Last active April 16, 2025 08:11
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@hsali
hsali / playing_random_audio_file.sh
Created November 15, 2016 18:18
Play random audio files from command line. It is mplayer which will play music command line.
#!/bin/bash
if [ "$1" = "" ]; then
echo "no directory defined!"
exit
fi
if [ "$2" = "" ]; then
echo "no file extension defined!"
@itod
itod / split_keyboards.md
Last active April 26, 2025 15:22
Every "split" mechanical keyboard currently being sold that I know of
@ByoungInKim
ByoungInKim / create_directory.py
Last active May 30, 2024 08:33
python - create directory if path if it doesn`t exist for file write
import os
directory = '/home/kenny/gist'
if not os.path.exists(directory):
os.makedirs(directory)