added bizzybotte, cleaned up backup

pull/1/head
Jeffrey Paul 13 years ago
parent 3cac5142f1
commit 2627ee4784
  1. 15
      bitcoin.shallow/generate.py
  2. 138
      bizzybotte/bizzybotte.pl
  3. 34
      osxbackup/backup.command

@ -8,12 +8,25 @@ import decimal
def main(argv): def main(argv):
current = fetch_mtgox_orders() current = fetch_mtgox_orders()
selling = selling_stats(current['bids'])
buying = buying_stats(current['asks'])
def selling_stats(bids):
high = max([bid[0] for bid in bids])
low = min([bid[0] for bid in bids])
print "highbid %s" % high
print "lowbid %s" % low
def buying_stats(asks):
pass
def fetch_mtgox_orders(): def fetch_mtgox_orders():
url = 'https://mtgox.com/code/data/getDepth.php' url = 'https://mtgox.com/code/data/getDepth.php'
parsed = json.loads( parsed = json.loads(
urllib.urlopen(url).read(), urllib.urlopen(url).read(),
parse_float=decimal.Decimal parse_float=decimal.Decimal
) )
print repr(parsed) return parsed
sys.exit(main(sys.argv)) sys.exit(main(sys.argv))

@ -0,0 +1,138 @@
use strict;
use warnings qw( all );
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '20070322';
%IRSSI = (
authors => 'sneak for #bantown',
contact => 'sneak@datavibe.net',
name => 'bizzybotte',
description => 'this script makes you sound like bizzy.',
license => 'Public Domain',
);
sub send_text {
#"send text", char *line, SERVER_REC, WI_ITEM_REC
my ( $data, $server, $witem ) = @_;
if ( $witem
&& ( $witem->{type} eq "CHANNEL" )
&& $data
)
{
$witem->command("msg $witem->{name} " . fuckestring($data));
Irssi::signal_stop();
}
}
sub fuckestring ($) {
my $string;
if(@_) {
$string = shift;
} else {
$string = $_;
}
return '' unless $string;
my @things = parseline($string);
my $out;
foreach my $thing (@things) {
if($thing->{'type'} eq 'word') {
my $word = suffixword($thing->{'content'});
$word = uc($word)
if
uc($thing->{'content'}) eq $thing->{'content'};
$out .= $word;
} else {
$out .= $thing->{'content'};
}
}
return $out;
}
sub parseline {
local $_ = shift;
return unless $_;
my @sentence;
until (/\G$/gc) { # until pos at end of string
if (/\G([A-Za-z']+)/gc) {
push @sentence, { type => 'word', 'content' => $1 };
} elsif (/\G([^A-Za-z']+)/gc) {
push @sentence, { type => 'other', 'content' => $1} ;
}
}
return @sentence;
}
sub suffixword {
local $_ = shift;
return unless $_;
return('lolle') if lc($_) eq 'lol';
return('butte') if lc($_) eq 'but';
# some simple skips:
my $tmp = lc($_);
$tmp =~ s/[^a-z]//g;
return $_ if length($tmp) < 4;
#foreach my $skip (qw(
# bad heh ooh
#)) {
# return $_ if $tmp eq $skip;
#}
# skip rules:
foreach my $suf (qw( e ng ing ed es ah l er )) {
if(/$suf[sS]*$/i) {
return $_;
}
}
my $out = $_;
# special cases where a consonant gets doubled
return('whatte') if ($tmp eq 'what');
# letters that end words that get doubled
# i.e. l as in 'lol'->'lolle'
foreach my $suf (qw( l g m n et p r )) {
if(/${suf}[sS]*$/i) {
return double_laste($_);
} else {
next;
}
return $out;
}
# letters that end words that just get 'e'
# i.e. k as in 'fuck'->'fucke'
foreach my $suf (qw( d k h t )) {
if(/$suf[sS]*$/i) {
return single_laste($_);
} else {
next;
}
}
# if we got this far, just return the original word unmodified
return $_;
}
sub single_laste {
local $_ = shift;
my $s = '';
if(/s$/i) { $s = 's'; s/s$//; }
return($_ . 'e' .$s);
}
sub double_laste {
local $_ = shift;
my $s = '';
if(/s$/i) { $s = 's'; s/s$//; }
/([a-zA-Z])$/;
my $last = $1;
$last = '' if /${last}${last}$/;
return($_ . $last . 'e' . $s);
}
Irssi::signal_add('send text' => 'send_text');

@ -7,8 +7,7 @@
NOW="`date +%Y%m%d.%H%M%S`" NOW="`date +%Y%m%d.%H%M%S`"
BACKUPHOST=${BACKUPHOST:-"jfk1.datavibe.net"} BACKUPDEST=${BACKUPDEST:-"${USER}@jfk1.datavibe.net:backup/"}
SERVERPATH=${SERVERPATH:-backup/}
RSYNC="/usr/bin/rsync" RSYNC="/usr/bin/rsync"
OPTS="-aPSz --no-owner --no-group --delete-excluded --delete-after" OPTS="-aPSz --no-owner --no-group --delete-excluded --delete-after"
@ -24,13 +23,8 @@ RE+=" --exclude=/Library/Application?Support/Evernote/"
RE+=" --exclude=/Library/Application?Support/InsomniaX/" RE+=" --exclude=/Library/Application?Support/InsomniaX/"
RE+=" --exclude=/Music/iTunes/Album?Artwork/" RE+=" --exclude=/Music/iTunes/Album?Artwork/"
RE+=" --exclude=/Documents/Steam?Content/" RE+=" --exclude=/Documents/Steam?Content/"
RE+=" --exclude=/tmp/"
RE+=" --exclude=/.Spotlight-V100/"
RE+=" --exclude=/.fseventsd/"
RE+=" --exclude=/.cpan/build/" RE+=" --exclude=/.cpan/build/"
RE+=" --exclude=/.cpan/sources/" RE+=" --exclude=/.cpan/sources/"
RE+=" --exclude=/.Trash/"
RE+=" --exclude=/.Trashes/"
RE+=" --exclude=/Library/Logs/" RE+=" --exclude=/Library/Logs/"
# keep your mail on the server! # keep your mail on the server!
RE+=" --exclude=/Library/Mail/" RE+=" --exclude=/Library/Mail/"
@ -48,40 +42,50 @@ RE+=" --exclude=/Library/Safari/HistoryIndex.sk"
RE+=" --exclude=/Library/Application?Support/CrossOver?Games/" RE+=" --exclude=/Library/Application?Support/CrossOver?Games/"
RE+=" --exclude=/Library/Preferences/Macromedia/Flash?Player/" RE+=" --exclude=/Library/Preferences/Macromedia/Flash?Player/"
RE+=" --exclude=/Library/PubSub/" RE+=" --exclude=/Library/PubSub/"
# just say no to skynet
RE+=" --exclude=/Library/Google/" RE+=" --exclude=/Library/Google/"
RE+=" --exclude=/Library/Cookies/" RE+=" --exclude=/Library/Cookies/"
RE+=" --exclude=/.TemporaryItems/"
RE+=" --exclude=/.rnd/"
RE+=" --exclude=/Receivd/" RE+=" --exclude=/Receivd/"
MINRE="" MINRE=""
MINRE+=" --exclude=/.fseventsd/" MINRE+=" --exclude=/.fseventsd/"
MINRE+=" --exclude=/.Spotlight-V100/" MINRE+=" --exclude=/.Spotlight-V100/"
MINRE+=" --exclude=/.Trash/"
MINRE+=" --exclude=/.Trashes/" MINRE+=" --exclude=/.Trashes/"
MINRE+=" --exclude=/tmp/" MINRE+=" --exclude=/tmp/"
MINRE+=" --exclude=/.TemporaryItems/"
MINRE+=" --exclude=/.rnd/"
RE+=" ${MINRE}"
# before anything else, backup gpg keys if any: # before anything else, backup gpg keys if any:
if [ -d ${HOME}/.gnupg ]; then if [ -d ${HOME}/.gnupg ]; then
$RSYNC $OPTS -c ${HOME}/.gnupg/ ${BACKUPHOST}:${SERVERPATH}/Home/.gnupg/ $RSYNC $OPTS -c ${HOME}/.gnupg/ ${BACKUPDEST}/Home/.gnupg/
fi
if [ -d ${HOME}/Development ]; then
$RSYNC $OPTS -c ${HOME}/Development/ \
${BACKUPDEST}/Home/Development/
fi fi
RETVAL=255 RETVAL=255
while [ $RETVAL -ne 0 ]; do while [ $RETVAL -ne 0 ]; do
$RSYNC $OPTS $RE ${HOME}/ ${BACKUPHOST}:${SERVERPATH}/Home/ $RSYNC $OPTS $RE ${HOME}/ ${BACKUPDEST}/Home/
RETVAL=$? RETVAL=$?
sleep 1; sleep 1;
done done
RETVAL=255 RETVAL=255
while [ $RETVAL -ne 0 ]; do while [ $RETVAL -ne 0 ]; do
$RSYNC $OPTS $MINRE --exclude=/ApertureScience.sparsebundle/ /Volumes/Storage/ ${BACKUPHOST}:${SERVERPATH}/Storage/ $RSYNC $OPTS $MINRE --exclude=/ApertureScience.sparsebundle/ \
/Volumes/Storage/ ${BACKUPDEST}/Storage/
RETVAL=$? RETVAL=$?
sleep 1; sleep 1;
done done
RETVAL=255 RETVAL=255
while [ $RETVAL -ne 0 ]; do while [ $RETVAL -ne 0 ]; do
$RSYNC $OPTS /Applications/ ${BACKUPHOST}:${SERVERPATH}/Applications/ $RSYNC $OPTS /Applications/ ${BACKUPDEST}/Applications/
RETVAL=$? RETVAL=$?
sleep 1; sleep 1;
done done
@ -91,7 +95,8 @@ open /Volumes/Storage/ApertureScience.sparsebundle
if [ -e /Volumes/ApertureScience ]; then if [ -e /Volumes/ApertureScience ]; then
RETVAL=255 RETVAL=255
while [ $RETVAL -ne 0 ]; do while [ $RETVAL -ne 0 ]; do
$RSYNC $OPTS $MINRE /Volumes/ApertureScience/ ${BACKUPHOST}:${SERVERPATH}/ApertureScience/ $RSYNC $OPTS $MINRE /Volumes/ApertureScience/ \
${BACKUPDEST}/ApertureScience/
RETVAL=$? RETVAL=$?
sleep 1; sleep 1;
done done
@ -100,4 +105,3 @@ fi
# FIXME todo do some error checking on the non-mountability of the # FIXME todo do some error checking on the non-mountability of the
# ApertureScience volume # ApertureScience volume

Loading…
Cancel
Save