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
# the tags' href is in the form "mm.dd.yy Un-URI-encoded File Title.mp3" | |
MP3_basename = %r{([^/]+)\.mp3$} | |
res = doc.css("a").collect do |node| | |
begin | |
href = node['href'] | |
title = MP3_basename.match(href)[1].sub(/^(\d\d)\.(\d\d)\.\d\d /,'\1-\2 ') | |
node['href'] = "%s/%s" % [BASEHREF, href] | |
node.inner_html = Nokogiri::HTML.fragment(title) # to HTML-encode |
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
CAVEAT | |
------ | |
These notes should apply equally, with little to no modification, to | |
both Ubuntu and Debian systems. | |
================================================================================ |
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 | |
if [ -z "$1" ]; then | |
echo "Usage: $(basename $0) debfile_containing_fonts.deb" | |
exit 2 | |
fi | |
DEB=$1 | |
if tar --version|grep bsd >/dev/null; then |
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
# .zshrc fragment | |
setopt prompt_subst | |
autoload -Uz vcs_info | |
if vcs_info 2> /dev/null; then | |
zstyle ':vcs_info:*' disable cdv darcs mtn p4 svk tla | |
zstyle ':vcs_info:*' actionformats " [%s:b|%a]" | |
zstyle ':vcs_info:*' formats " [%s:%b]" | |
zstyle ':vcs_info:cvs:*' formats " [%s:%r]" |
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
kane:~>% sudo smartctl --all -T permissive /dev/sdb < 12:50:30 | |
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen | |
Home page is http://smartmontools.sourceforge.net/ | |
Device: WD 5000BEV External Version: 1.75 | |
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0 | |
>> Terminate command early due to bad response to IEC mode page | |
Error Counter logging not supported | |
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0 |
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/perl -wT | |
# No non-standard modules. | |
# Not ideal for non-simple field names; | |
# suggest a split-based algo for those. | |
# *shrug* I got bored. | |
use strict; | |
my $cfg_file = "testdata.cfg"; |
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
/* | |
* strkittens | |
* | |
* Conceptually, strcat() is a sequence of strlen() followed by a | |
* strcpy() using the offset derived from strlen(). | |
* These functions build on that idea. | |
* | |
* None of the FreeBSD, OpenBSD, nor Linux/glibc implementations | |
* of strcat() use this delegation to strcpy(), presumably because | |
* the pointer-based strcpy() algorithm, when used with short strings, |
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 racket | |
#lang racket/base | |
(require net/base64) | |
;; tunables | |
(define amount 32) | |
(define sources (list "/dev/urandom" "/dev/random")) | |
(define (read-entropy amt srcs) |
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
(define (vector-swap! v idx1 idx2) | |
(let ((temp (vector-ref v idx1))) | |
(cond ((= idx1 idx2) v) | |
(else (vector-set! v idx1 (vector-ref v idx2)) | |
(vector-set! v idx2 temp) | |
v)))) | |
(define (vector-shuffle! vec) | |
(let vec-shuf-helper ([v vec] | |
[n (vector-length vec)]) |
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 | |
# decomp - decompress arbitrary archives by extension | |
# author: Tim Hammerquist <penryu@gmail.com> | |
UNZIP=`which unzip` | |
TAR=`which tar` | |
extract_zip="$UNZIP" | |
extract_tgz="$TAR zxf" | |
extract_tbz="$TAR jxf" |
OlderNewer