Skip to content

Instantly share code, notes, and snippets.

View melissaboiko's full-sized avatar
🐈

Melissa Boiko melissaboiko

🐈
View GitHub Profile
@melissaboiko
melissaboiko / color_ip.sh
Last active August 29, 2015 14:05
colorize output of Linux ip(8). suitable for replacement via alias (hopefully).
#!/bin/bash
# colorize output of Linux ip(8). suitable to replacement via alias (hopefully).
# expects GNU sed.
#
# expanded from:
# http://unix.stackexchange.com/questions/148/colorizing-your-terminal-and-shell-environment
IP_CMD=/bin/ip
NORMAL=`echo -e '\033[0m'`
@melissaboiko
melissaboiko / record-and-play.sh
Last active December 18, 2015 22:19
script for language learners to record and listen their own voice while studying
#!/bin/bash
# apt-get install sox
unset ans
tmp=$(mktemp).wav
while true; do
echo -n "Enter to start recording (Ctrl+C to finish), p to play again, q to quit... "
read ans
case "$ans" in
p) play $tmp;;
@melissaboiko
melissaboiko / compile-vocbras.sh
Created March 18, 2013 17:24
script to adapt "Vocabulário na Língua Brasílica", a 1621 Portuguese / Old Tupi dictionary, from its digitalized wiki version at http://vlb.wikispaces.com/ , to tab-separated and DICT (dictd) formats.
#!/bin/bash
#
# O "Vocabulário na Língua Brasílica", de 1621, é um dicionário jesuíta
# português/tupi antigo. Uma versão digital por Ensjo está disponível em
# http://vlb.wikispaces.com/ .
#
# Este script simples adapta a versão wiki para:
# 1. formato texto .tsv, separado por tabs (bom para grep, cut e afins), e
# 2. formatos .index e .dict para o protocolo DICT (dictd, dict(1) etc.)
#
@melissaboiko
melissaboiko / retrograde_mercury.py
Created November 9, 2012 16:19
Tell whether Mercury is retrograde (astrologically bad for computer networks)
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
from datetime import *
import argparse
import sys
# this script has no actual code to calculate retrograde motion. sorry!
CSI = '['
@melissaboiko
melissaboiko / hexawords.sh
Created November 1, 2012 12:30
script to generate hexadecimal "words". warning: this makes your identifiers more vulnerable to discover.
#!/bin/bash -e
sources='/usr/share/dict/american-english /usr/share/dict/brazilian'
function usage()
{
echo "Script to find words that can be spelled in hexa.
Notice that this can make identifiers more vulnerable to discovery.
By default, this uses English and Brazilian wordlists; edit the script
header if this is undesirable. Works better if uni2ascii is installed.
@melissaboiko
melissaboiko / crep
Created July 6, 2012 15:41
simple script to color matching lines (like grep --color, but also prints non-matching lines)
#!/bin/bash
pname="$(basename $0)"
function usage()
{
echo "Usage: $pname [OPTIONS] PATTERN [FILES and/or GREP_OPTIONS...]
Colorize all matches for PATTERN, an extended regular expression.
Non-matching lines are still printed.
@melissaboiko
melissaboiko / xkcd_password.sh
Created February 24, 2012 21:15
kind of dumb script to generate xkcd-style password
#!/bin/bash
# http://xkcd.com/936/
# http://namakajiri.net/misc/substantivos_pt.ascii
# TODO: getopt
# dict="/usr/share/dict/words"
# dict="/usr/share/dict/brazilian.utf8"
dict=/usr/local/share/dict/substantivos_pt.ascii
@melissaboiko
melissaboiko / id3_utf8.py
Created September 1, 2011 20:14
python script to convert id3 fields to unicode
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
# TODO: doesn’t convert to id3v2; eyed3 and mutagen have been fussy
# with non-utf tags
# TODO: prints, prints everywhere
import sys
from ID3 import *
@melissaboiko
melissaboiko / nostalgic.py
Created July 13, 2011 13:45
simple matrix-style demo. done out of nostalgia for what it was like to study linux in the 90s.
#!/usr/bin/env python
import locale
import curses as c
from curses.wrapper import wrapper
import random
locale.setlocale(locale.LC_ALL,'')
coding = locale.getpreferredencoding()
random.seed()
# more = use digits more often
@melissaboiko
melissaboiko / update-edict.sh
Created December 29, 2010 14:23
simple script to update to latest edict (JMdict). I put it in /etc/cron.daily .
#!/bin/bash
set -e
tmp="$(mktemp)"
dest="/usr/share/edict/edict.utf8"
function cleanup()
{
rm -f "$tmp"
}