Skip to content

Instantly share code, notes, and snippets.

View melissaboiko's full-sized avatar
🐈

Melissa Boiko melissaboiko

🐈
View GitHub Profile
#!/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
#!/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 November 29, 2010 18:49
Query Cambridge online dictionary for IPA pronunciation of English words.
#!/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 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"
}
@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 / 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 / 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 / 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 / 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 / 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 = '['