Skip to content

Instantly share code, notes, and snippets.

@melissaboiko
melissaboiko / color_ip.sh
Last active Aug 29, 2015
colorize output of Linux ip(8). suitable for replacement via alias (hopefully).
View color_ip.sh
#!/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'`
View telnet.sh
#!/bin/bash
# a telnet-like command to debug text protocols over SSL (https, smtps...).
# usage:
# telnets example.com https
# telnets example.com:https
# telnets https://example.com
if echo "$1" | grep -q "^[a-z]*://"; then
View 2awesome.py
#!/usr/bin/env python
# from:
# http://i.imgur.com/7atJf.png
# http://www.reddit.com/r/offbeat/comments/dqtxn/a_friend_of_mine_postulates_that_if_you_stick_two/
#
# available at http://namakajiri.net/misc/2awesome.py
import random
awesome = [
'rocket',
@melissaboiko
melissaboiko / ipa-cambridge.rb
Created Nov 29, 2010
Query Cambridge online dictionary for IPA pronunciation of English words.
View ipa-cambridge.rb
#!/usr/bin/env ruby1.8
# Query Cambridge online dictionary for IPA pronunciation of English words.
#
# A tad slow and messy, but works (as of 2010-11-29).
require 'rubygems'
require 'nokogiri'
require 'open-uri'
@melissaboiko
melissaboiko / update-edict.sh
Created Dec 29, 2010
simple script to update to latest edict (JMdict). I put it in /etc/cron.daily .
View update-edict.sh
#!/bin/bash
set -e
tmp="$(mktemp)"
dest="/usr/share/edict/edict.utf8"
function cleanup()
{
rm -f "$tmp"
}
@melissaboiko
melissaboiko / nostalgic.py
Created Jul 13, 2011
simple matrix-style demo. done out of nostalgia for what it was like to study linux in the 90s.
View nostalgic.py
#!/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 / id3_utf8.py
Created Sep 1, 2011
python script to convert id3 fields to unicode
View id3_utf8.py
#!/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 / xkcd_password.sh
Created Feb 24, 2012
kind of dumb script to generate xkcd-style password
View xkcd_password.sh
#!/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 / crep
Created Jul 6, 2012
simple script to color matching lines (like grep --color, but also prints non-matching lines)
View crep
#!/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 / hexawords.sh
Created Nov 1, 2012
script to generate hexadecimal "words". warning: this makes your identifiers more vulnerable to discover.
View hexawords.sh
#!/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.