diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-23 14:04:50 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-23 14:04:50 -0400 |
commit | 08559bff349b8266331389c9a0c579798ce94b4c (patch) | |
tree | 829d8c4f0c12855814d1d4891889fbfc655de8ed /contrib/scripts | |
parent | a61901a0923a1b4413fcc44a8ff259d309c064b0 (diff) | |
download | fork-ledger-08559bff349b8266331389c9a0c579798ce94b4c.tar.gz fork-ledger-08559bff349b8266331389c9a0c579798ce94b4c.tar.bz2 fork-ledger-08559bff349b8266331389c9a0c579798ce94b4c.zip |
Moved scripts from contrib/scripts/ into contrib/
Diffstat (limited to 'contrib/scripts')
-rw-r--r-- | contrib/scripts/README | 4 | ||||
-rwxr-xr-x | contrib/scripts/bal | 21 | ||||
-rwxr-xr-x | contrib/scripts/bal-huquq | 21 | ||||
-rwxr-xr-x | contrib/scripts/entry | 16 | ||||
-rwxr-xr-x | contrib/scripts/getquote | 16 | ||||
-rwxr-xr-x | contrib/scripts/ledger-du | 49 | ||||
-rwxr-xr-x | contrib/scripts/report | 21 | ||||
-rwxr-xr-x | contrib/scripts/tc | 7 | ||||
-rwxr-xr-x | contrib/scripts/ti | 5 | ||||
-rwxr-xr-x | contrib/scripts/to | 3 | ||||
-rwxr-xr-x | contrib/scripts/trend | 30 |
11 files changed, 0 insertions, 193 deletions
diff --git a/contrib/scripts/README b/contrib/scripts/README deleted file mode 100644 index 6108afbf..00000000 --- a/contrib/scripts/README +++ /dev/null @@ -1,4 +0,0 @@ -This scripts are provided just to give some ideas. They probably need -to be modified to better suit your environment. Beware! - -John diff --git a/contrib/scripts/bal b/contrib/scripts/bal deleted file mode 100755 index 423e3e41..00000000 --- a/contrib/scripts/bal +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -switch="-c" -limit="-t (/Liabilities/?a<0:Ua>100)&a" - -if [ "$1" = "-C" -o "$1" = "-U" ]; then - switch="$1" - shift -elif [ "$1" = "-b" -o "$1" = "-e" -o "$1" = "-p" ]; then - switch="$1 $2" - shift 2 -fi - -accts="$@" -if [ -z "$accts" ]; then - accts="-Equity -Income -Expenses" -else - limit="" -fi - -ledger -VQ $switch $limit -s -S "-UT" balance $accts diff --git a/contrib/scripts/bal-huquq b/contrib/scripts/bal-huquq deleted file mode 100755 index fad2854a..00000000 --- a/contrib/scripts/bal-huquq +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -switch="-c" -limit="-t (/Liabilities/?(/Huquq/?a/P{2.22AU}<={-1.0}:a<0):Ua>100)&a" - -if [ "$1" = "-C" -o "$1" = "-U" ]; then - switch="$1" - shift -elif [ "$1" = "-b" -o "$1" = "-e" -o "$1" = "-p" ]; then - switch="$1 $2" - shift 2 -fi - -accts="$@" -if [ -z "$accts" ]; then - accts="-Equity -Income -Expenses" -else - limit="" -fi - -ledger -VQ $switch $limit -s -S "-UT" balance $accts diff --git a/contrib/scripts/entry b/contrib/scripts/entry deleted file mode 100755 index cc030d8e..00000000 --- a/contrib/scripts/entry +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -if [ -z "$LEDGER" -o ! -r "$LEDGER" ]; then - echo Please set your LEDGER environment variable. -fi - -line=`wc -l $LEDGER | awk '{print $1}'` - -if ledger entry "$@" > /tmp/entry; then - cat /tmp/entry >> $LEDGER -else - echo "$@" >> $LEDGER -fi -rm /tmp/entry - -vi +$line $LEDGER diff --git a/contrib/scripts/getquote b/contrib/scripts/getquote deleted file mode 100755 index bed561d6..00000000 --- a/contrib/scripts/getquote +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl - -$timeout = 60; - -use Finance::Quote; - -$q = Finance::Quote->new; -$q->timeout($timeout); -$q->require_labels(qw/price/); - -%quotes = $q->fetch("nasdaq", $ARGV[0]); -if ($quotes{$ARGV[0], "price"}) { - print "\$", $quotes{$ARGV[0], "price"}, "\n"; -} else { - exit 1; -} diff --git a/contrib/scripts/ledger-du b/contrib/scripts/ledger-du deleted file mode 100755 index f5d7dd7d..00000000 --- a/contrib/scripts/ledger-du +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -import string -import sys -import os -import time - -from stat import * -from os.path import * - -def report_file(path): - dir_elems = string.split(dirname(path), os.sep) - if dir_elems[0] == "." or dir_elems[0] == "": - dir_elems = dir_elems[1 :] - account = string.join(dir_elems, ":") - - info = os.stat(path) - print time.strftime("%Y/%m/%d", time.localtime(info[ST_MTIME])), - - print basename(path) - print " ", account, " ", info[ST_SIZE], "b" - print " Equity:Files" - print - -def find_files(path): - entries = os.listdir(path) - for entry in entries: - entry = join(path, entry) - if not islink(entry): - if isdir(entry) and entry != "/proc": - find_files(entry) - else: - report_file(entry) - -args = sys.argv[1:] -if len(args): - paths = args -else: - paths = ["."] - -print """ -C 1.00 Kb = 1024 b -C 1.00 Mb = 1024 Kb -C 1.00 Gb = 1024 Mb -C 1.00 Tb = 1024 Gb -""" - -for path in paths: - find_files(path) diff --git a/contrib/scripts/report b/contrib/scripts/report deleted file mode 100755 index 24418cdc..00000000 --- a/contrib/scripts/report +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# This script facilities plotting of a ledger register report. If you -# use OS/X, and have AquaTerm installed, you will probably want to set -# LEDGER_TERM to "aqua". -# -# Examples of use: -# -# report -j -M reg food # plot monthly food costs -# report -J reg checking # plot checking account balance - -if [ -z "$LEDGER_TERM" ]; then - LEDGER_TERM="x11 persist" -fi - -(cat <<EOF; ledger "$@") | gnuplot - set terminal $LEDGER_TERM - set xdata time - set timefmt "%Y/%m/%d" - plot "-" using 1:2 with lines -EOF diff --git a/contrib/scripts/tc b/contrib/scripts/tc deleted file mode 100755 index c24be99a..00000000 --- a/contrib/scripts/tc +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -timeclock out - -proj="$1" -shift -timeclock in "$proj" "$@" diff --git a/contrib/scripts/ti b/contrib/scripts/ti deleted file mode 100755 index a7214e65..00000000 --- a/contrib/scripts/ti +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -proj="$1" -shift -timeclock in "$proj" "$@" diff --git a/contrib/scripts/to b/contrib/scripts/to deleted file mode 100755 index 3198db3c..00000000 --- a/contrib/scripts/to +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -timeclock out "$@" diff --git a/contrib/scripts/trend b/contrib/scripts/trend deleted file mode 100755 index 3c189c0b..00000000 --- a/contrib/scripts/trend +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# This script requires Python support. -# -# To use, just run "trend" with the accounts to compute the trend for: -# -# trend dining -# -# The trend values are not terribly meaningful, but this gives an -# example of how Python can be used to create more complex reports. - -ledger --import-stdin -T "@rdev()" reg "$@" <<EOF -import ledger - -mean = ledger.parse_value_expr ("AT") -last_mean = None -last_dev = None - -def rdev (details): - global last_mean, last_dev - mval = mean.compute (details) - if last_mean is None: - dev = ledger.Value () - else: - dev = mval - last_mean - dev = (last_dev + dev) / 2 - last_mean = mval - last_dev = dev - return dev -EOF |