This file contains hidden or 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 | |
# AstralCat | |
# Transmits data over IPv4 net using Astral routing | |
# | |
if [ -z $1 ] ; then | |
echo "Usage:" | |
echo "ac scream < file # transmit data" | |
echo "ac listen > file # receive data" |
This file contains hidden or 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 | |
echo "Cleaning up..." | |
rm 00-index.tar.gz | |
mkdir -p package | |
echo "Downloading index..." | |
wget http://hackage.haskell.org/packages/archive/00-index.tar.gz | |
for splitpk in `tar tf 00-index.tar.gz | cut -d/ -f 2,3`; do | |
pk=`echo $splitpk | sed 's|/|-|'` | |
name=$pk.tar.gz |
This file contains hidden or 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
# usage: ruby arch.rb <size> <files...> | |
size = ARGV.shift.to_i | |
$sizes_map = [] | |
ARGV.each do |f| | |
$sizes_map << [File.size(f), f] | |
end |
This file contains hidden or 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 | |
TEMP=`mktemp -d` | |
unzip -d $TEMP $1 | |
for fb2 in $TEMP/*.fb2; do | |
html2text -ascii $fb2 | enconv -L ru -x CP1251 > $fb2.txt | |
rm $fb2 | |
done | |
rm $1 | |
zip -j $1 $TEMP/* |
This file contains hidden or 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 | |
TEMP=`mktemp` | |
rm $TEMP | |
zip -u $TEMP $2 | |
cat $1 $TEMP > $3 | |
rm $TEMP |
This file contains hidden or 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 ruby | |
# usage: ./shitcounter.rb firefox log.txt | |
browser = ARGV[0] | |
logfile = File.open(ARGV[1], "w") | |
def ps_aux(grep = nil) | |
unf = `ps aux`.split("\n")[1..-1].map do |v| v.split(/\s+/) end | |
if grep | |
unf.select do |v| |
This file contains hidden or 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
require 'uri/http' | |
require 'net/http' | |
if ARGV.size < 2 | |
puts "Usage: lyrics.rb <Artist> <Title>" | |
exit 1 | |
end | |
artist = URI.escape(ARGV[0]) | |
title = URI.escape(ARGV[1]) |
This file contains hidden or 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
=begin | |
Tokyo Cabinet vs. SQLite indexed string selection & inserting test | |
Install gems "tokyocabinet" and "sqlite-ruby" | |
% ruby test.rb | |
Creating SQlite db.. user system total real | |
Generating test data... 100.700000 8.500000 109.200000 (110.876452) | |
Generating random selection set... 0.160000 0.050000 0.210000 ( 0.202189) |
This file contains hidden or 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
class FireUrlPlugin < Plugin | |
def fireurl(m, params) | |
u = URI.parse(params[:what]) | |
if u.path | |
path = u.path | |
path.gsub! %r|([^/]+)| do |s| | |
URI.escape(s, /./) | |
end | |
u.path = path | |
end |
This file contains hidden or 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 test "$(file -b --mime-type `which $1`)" == "text/x-python"; then | |
echo "Run for your lives!!!" | |
else | |
echo "No python" | |
fi |