summaryrefslogtreecommitdiffstats
path: root/gold
diff options
context:
space:
mode:
Diffstat (limited to 'gold')
-rw-r--r--gold/Makefile5
-rw-r--r--gold/affiliate/README.md9
-rw-r--r--gold/affiliate/affiliate.user.js96
-rw-r--r--gold/affiliate/krebsco-affiliatefox.xpibin0 -> 8711 bytes
-rwxr-xr-xgold/bitcoinslc/bitcoinslc.stats4
-rwxr-xr-xgold/bitcoinslc/bitcoinslc.stats.render7
-rwxr-xr-xgold/bitcoinslc/stats_text.sh4
-rw-r--r--gold/bitcoinwisdom/beep.js30
-rw-r--r--gold/bitcoinwisdom/ticker.js95
-rw-r--r--gold/btcguild/index.js20
-rwxr-xr-xgold/json/render/ticker7
-rwxr-xr-xgold/ledger/lib/balance88
-rw-r--r--gold/mining/CONFIGURE8
-rw-r--r--gold/mining/Makefile20
-rw-r--r--gold/mining/README9
-rw-r--r--gold/mining/TODO2
-rwxr-xr-xgold/mining/bin/archlinux-cruise-control75
-rwxr-xr-xgold/mining/bin/ati_temper5
-rwxr-xr-xgold/mining/bin/cleanup_tmp4
-rwxr-xr-xgold/mining/bin/ensure-router36
-rwxr-xr-xgold/mining/bin/ensure-wlan048
-rw-r--r--gold/mining/poll_btcguild2
-rw-r--r--gold/mining/user/.config/autostart/startup.desktop6
-rw-r--r--gold/mining/user/mining.ovdr16
-rwxr-xr-xgold/mining/user/startup.sh13
-rwxr-xr-xgold/mooncoin/ticker2
-rwxr-xr-xgold/mooncoin/ticker_text.sh4
-rwxr-xr-xgold/mtgox/mtgox.getDepth3
-rwxr-xr-xgold/mtgox/mtgox.getTrades3
-rwxr-xr-xgold/mtgox/mtgox.ticker53
-rwxr-xr-xgold/mtgox/ticker_text.sh4
-rwxr-xr-xgold/scex/ticker2
-rwxr-xr-xgold/scex/ticker_text.sh4
-rw-r--r--gold/scex/tracer/index.js89
-rw-r--r--gold/scex/tracer/slurp.js38
-rw-r--r--gold/scoreboard/.gitignore5
-rw-r--r--gold/scoreboard/README29
-rw-r--r--gold/scoreboard/modules/active/.placeholder0
-rwxr-xr-xgold/scoreboard/modules/available/ati_temper/gather14
-rwxr-xr-xgold/scoreboard/modules/available/ati_temper/index4
-rwxr-xr-xgold/scoreboard/modules/available/ati_temper/init28
-rwxr-xr-xgold/scoreboard/modules/available/ati_temper/plot10
-rwxr-xr-xgold/scoreboard/modules/available/bitcoin/gather13
-rwxr-xr-xgold/scoreboard/modules/available/bitcoin/index4
-rwxr-xr-xgold/scoreboard/modules/available/bitcoin/init48
-rwxr-xr-xgold/scoreboard/modules/available/bitcoin/plot11
-rw-r--r--gold/scoreboard/modules/available/bitcoin/render10
-rwxr-xr-xgold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats11
-rwxr-xr-xgold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live8
-rwxr-xr-xgold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats18
-rwxr-xr-xgold/scoreboard/modules/available/btcguild/btcguild_stats22
-rwxr-xr-xgold/scoreboard/modules/available/btcguild/btcguild_stats_self15
-rwxr-xr-xgold/scoreboard/modules/available/create_gnuplot196
-rwxr-xr-xgold/scoreboard/modules/available/solidcoin/gather12
-rwxr-xr-xgold/scoreboard/modules/available/solidcoin/index4
-rwxr-xr-xgold/scoreboard/modules/available/solidcoin/init48
-rwxr-xr-xgold/scoreboard/modules/available/solidcoin/plot11
-rw-r--r--gold/scoreboard/modules/available/solidcoin/render10
-rwxr-xr-xgold/scoreboard/modules/available/static/init32
-rw-r--r--gold/scoreboard/profile26
-rwxr-xr-xgold/scoreboard/util/run-folder6
-rwxr-xr-xgold/scoreboard/util/schedule_logger13
62 files changed, 1419 insertions, 0 deletions
diff --git a/gold/Makefile b/gold/Makefile
new file mode 100644
index 00000000..97ddcf71
--- /dev/null
+++ b/gold/Makefile
@@ -0,0 +1,5 @@
+install:
+ ln -snf $$PWD/mtgox/ticker_text.sh ../bin/mtgox_ticker
+ ln -snf $$PWD/scex/ticker_text.sh ../bin/scex_ticker
+ ln -snf $$PWD/mooncoin/ticker_text.sh ../bin/mooncoin_ticker
+ ln -snf $$PWD/bitcoinslc/stats_text.sh ../bin/bitcoinslc_stats
diff --git a/gold/affiliate/README.md b/gold/affiliate/README.md
new file mode 100644
index 00000000..81a3d52c
--- /dev/null
+++ b/gold/affiliate/README.md
@@ -0,0 +1,9 @@
+# Installation
+
+# Firefox
+Step 1: [Install Greasemonkey](https://addons.mozilla.org/de/firefox/addon/greasemonkey/)
+Step 2: Click on affiliate.user.js
+
+# Chrome
+Step 1: download affiliate.user.js onto your desktop
+Step 2: Open chrome->tools->extensions and drag affiliate.user.js into chrome window
diff --git a/gold/affiliate/affiliate.user.js b/gold/affiliate/affiliate.user.js
new file mode 100644
index 00000000..57d51f1f
--- /dev/null
+++ b/gold/affiliate/affiliate.user.js
@@ -0,0 +1,96 @@
+// ==UserScript==
+// @name Krebs Affiliate Programs + extras (auto-SSL...)
+// @namespace https://blogs.fsfe.org/h2/userscripts/
+// @description Modify Amazon to support Krebs, always use SSL and shorten links (only Amazon)
+
+// Contains the getASIN()-function from:
+// http://userscripts.org/scripts/review/3284 by Jim Biancolo
+
+// shamelessly stolen from
+// http://userscripts.org/scripts/show/129547
+//
+
+// @version 0.42
+// @include *
+// @license CC0 / Do what the fuck you want to license
+// see http://sam.zoy.org/wtfpl/
+// see http://creativecommons.org/publicdomain/zero/1.0/
+
+// @author Hannes Hauswedell
+// @author makefu
+// @homepage http://euer.krebsco.de
+// ==/UserScript==
+
+
+
+function getASIN(href) {
+ var asinMatch;
+ asinMatch = href.match(/\/exec\/obidos\/ASIN\/(\w{10})/i);
+ if (!asinMatch) { asinMatch = href.match(/\/gp\/product\/(\w{10})/i); }
+ if (!asinMatch) { asinMatch = href.match(/\/exec\/obidos\/tg\/detail\/\-\/(\w{10})/i); }
+ if (!asinMatch) { asinMatch = href.match(/\/dp\/(\w{10})/i); }
+ if (!asinMatch) { return null; }
+ return asinMatch[1];
+}
+
+(function()
+{
+ var links = document.getElementsByTagName("a");
+
+ for (i = 0; i < links.length; i++)
+ {
+ var curLink = links[i].href;
+
+ // AMAZON
+ if (curLink.match(/https?\:\/\/(www\.)?amazon\./i))
+ {
+ var affiliateID = '';
+ var host = '';
+ if (curLink.match(/amazon\.de/i))
+ {
+ host = 'amazon.de';
+ affiliateID = 'krebsco-21';
+ }
+ else if (curLink.match(/amazon\.co\.uk/i))
+ {
+ host = 'amazon.co.uk';
+ affiliateID = 'krebscode-21';
+ }
+ else if (curLink.match(/amazon\.ca/i))
+ {
+ host = 'amazon.ca';
+ affiliateID = 'krebscoca-20';
+ }
+ else if (curLink.match(/amazon\.fr/i))
+ {
+ host = 'amazon.fr';
+ affiliateID = 'krebscode01-21';
+ }
+ else if (curLink.match(/amazon\.es/i))
+ {
+ host = 'amazon.es';
+ affiliateID = 'krebscode0f-21';
+ }
+ else if (curLink.match(/amazon\.it/i))
+ {
+ host = 'amazon.it';
+ affiliateID = 'krebscode04-21';
+ }
+ else if (curLink.match(/amazon\.com/i))
+ {
+ host = 'amazon.com';
+ affiliateID = 'krebsco-20';
+ }
+
+ var asin = getASIN(curLink);
+ if (affiliateID != '')
+ {
+ if (asin != null)
+ links[i].setAttribute("href", "https://www."+host+"/dp/" + asin + "/?tag="+affiliateID);
+// else
+// links[i].setAttribute("href", curLink + "?tag="+affiliateID);
+ }
+ }
+
+ }
+})();
diff --git a/gold/affiliate/krebsco-affiliatefox.xpi b/gold/affiliate/krebsco-affiliatefox.xpi
new file mode 100644
index 00000000..b163e0bc
--- /dev/null
+++ b/gold/affiliate/krebsco-affiliatefox.xpi
Binary files differ
diff --git a/gold/bitcoinslc/bitcoinslc.stats b/gold/bitcoinslc/bitcoinslc.stats
new file mode 100755
index 00000000..8547dbcc
--- /dev/null
+++ b/gold/bitcoinslc/bitcoinslc.stats
@@ -0,0 +1,4 @@
+#! /bin/sh
+# get mtgox ticker data
+set -euf
+curl -ksS https://www.bitcoins.lc/stats.json
diff --git a/gold/bitcoinslc/bitcoinslc.stats.render b/gold/bitcoinslc/bitcoinslc.stats.render
new file mode 100755
index 00000000..7ab26a02
--- /dev/null
+++ b/gold/bitcoinslc/bitcoinslc.stats.render
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+import json,sys
+
+result = json.load(sys.stdin)
+
+print "Block: " + str(result["current_block"]) + " Difficulty: " + str(result["difficulty"])
diff --git a/gold/bitcoinslc/stats_text.sh b/gold/bitcoinslc/stats_text.sh
new file mode 100755
index 00000000..2d146c86
--- /dev/null
+++ b/gold/bitcoinslc/stats_text.sh
@@ -0,0 +1,4 @@
+#! /bin/sh
+set -euf
+cd $(dirname `readlink -f $0`)
+./bitcoinslc.stats | ./bitcoinslc.stats.render
diff --git a/gold/bitcoinwisdom/beep.js b/gold/bitcoinwisdom/beep.js
new file mode 100644
index 00000000..80a0cb0f
--- /dev/null
+++ b/gold/bitcoinwisdom/beep.js
@@ -0,0 +1,30 @@
+module.exports = {
+ create_beeper: create_beeper,
+}
+
+var child_process = require('child_process');
+
+function create_beeper (spec) {
+ return {
+ beep: beep,
+ }
+ function beep (freq, len) {
+ var child = child_process.spawn('beep', [
+ '-f', freq,
+ '-l', len,
+ ]);
+ child.stdout.on('data', function (data) {
+ console.log('stdout: ' + data);
+ });
+
+ child.stderr.on('data', function (data) {
+ console.log('stderr: ' + data);
+ });
+
+ child.on('close', function (code) {
+ if (code !== 0) {
+ console.log('child process exited with code ' + code);
+ }
+ });
+ }
+}
diff --git a/gold/bitcoinwisdom/ticker.js b/gold/bitcoinwisdom/ticker.js
new file mode 100644
index 00000000..002f8502
--- /dev/null
+++ b/gold/bitcoinwisdom/ticker.js
@@ -0,0 +1,95 @@
+var http = require('http');
+var beeper = require('./beep.js').create_beeper();
+
+setInterval(get_ticker, 1000);
+
+function get_ticker () {
+ http.get('http://s1.bitcoinwisdom.com:8080/ticker', ticker_response_handler);
+}
+
+function ticker_response_handler (res) {
+ var data = '';
+ res.on('data', function (chunk) {
+ data += chunk;
+ });
+ res.on('end', function () {
+ try {
+ data = JSON.parse(data);
+ } catch (err) {
+ return console.log('Error:', err);
+ }
+ ticker_data_handler(data);
+ });
+}
+
+var last_data = {
+ btceltcbtc: {
+ last: 0, // price
+ date: 0,
+ tid: 0,
+ },
+}
+
+function ticker_data_handler (data) {
+ //console.log(data)
+
+ var symbol = 'btceltcbtc'
+
+ var ticker = data[symbol]
+ var last_ticker = last_data[symbol]
+
+ if (ticker.date !== last_ticker.date) {
+
+ var diff = ticker.last - last_ticker.last;
+
+ var lag = data.now - ticker.date;
+
+ freq = ( Math.pow(2000, ticker.last / last_ticker.last )) | 0;
+
+ var out = [
+ format_date(data.now) + '+' + pad(lag, -2, '0'),
+ '\x1b[' + diff_color(diff) + 'm'
+ + ticker.last.toFixed(8)
+ + '\x1b[m',
+ symbol,
+ freq,
+ ];
+
+ console.log(out.join(' '));
+
+ beeper.beep(freq, 10);
+ }
+
+ last_data[symbol] = data[symbol];
+}
+
+function diff_color (diff) {
+ if (diff < 0) {
+ return '31;1';
+ } else if (diff > 0) {
+ return '32;1';
+ } else {
+ return '33;1';
+ }
+}
+
+function format_date (unix) {
+ return (new Date(unix * 1000)).toISOString()
+ .replace(/\.000Z$/, 'Z')
+}
+
+// num < 0: pad left
+// num > 0: pad right
+function pad (obj, num, char) {
+ var str = obj.toString();
+ if (num < 0) {
+ while (str.length < -num) {
+ str = char + str;
+ }
+ } if (num > 0) {
+ while (str.length < num) {
+ str = str + char;
+ }
+ }
+ return str;
+}
diff --git a/gold/btcguild/index.js b/gold/btcguild/index.js
new file mode 100644
index 00000000..1f33db06
--- /dev/null
+++ b/gold/btcguild/index.js
@@ -0,0 +1,20 @@
+api_key = process.env.api_key;
+
+var options = {
+ host: 'www.btcguild.com',
+ port: 80,
+ path: '/api.php?api_key=' + api_key
+};
+
+http = require('http');
+http.get(options, function(res) {
+ var data = '';
+ res.on('data', function (chunk) {
+ data += chunk;
+ });
+ res.on('end', function () {
+ console.log(JSON.parse(data));
+ });
+}).on('error', function(e) {
+ console.error('Error: ' + e.message);
+});
diff --git a/gold/json/render/ticker b/gold/json/render/ticker
new file mode 100755
index 00000000..727dd594
--- /dev/null
+++ b/gold/json/render/ticker
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+import json,sys
+
+result = json.load(sys.stdin)
+
+print "High: " + str(result["ticker"]["high"]) + " Low: " + str(result["ticker"]["low"]) + " Last: " + str(result["ticker"]["last"])
diff --git a/gold/ledger/lib/balance b/gold/ledger/lib/balance
new file mode 100755
index 00000000..deb50d15
--- /dev/null
+++ b/gold/ledger/lib/balance
@@ -0,0 +1,88 @@
+#! /usr/bin/awk -f
+#
+# ledger balance calculator
+#
+# usage:
+# [colorize=false] [scale=N] //ledger/lib/balance LEDGER_FILE...
+# [colorize=false] [scale=N] //ledger/lib/balance < LEDGER_FILE
+#
+# description:
+# The ledger balance calculator computes the balance of each account it
+# encounters in the provided ledger files.
+#
+# example:
+# //ledger/lib/balance < //cholerab/ledger-spec.markdown
+#
+# see also:
+# //cholerab/ledger-spec.markdown (ledger file format)
+#
+
+BEGIN {
+ colorize = ENVIRON["colorize"] == "" || ENVIRON["colorize"] == "true"
+ # TODO use bc for arbitrary precision arithmetic
+ scale = ENVIRON["scale"]
+}
+
+/^[[:space:]]*[0-9]+-[0-9][0-9]-[0-9][0-9]/{
+ tx($2, $3, $4, $5)
+}
+
+END {
+ display_accounts()
+}
+
+function tx (dst, src, amt, u) {
+ withdraw(src, amt, u)
+ deposit(dst, amt, u)
+}
+
+function deposit (name, amt, u) {
+ accounts[name][u] += amt
+}
+
+function withdraw (name, amt, u) {
+ accounts[name][u] -= amt
+}
+
+function display_accounts() {
+ max_name_len = 0
+ for (name in accounts) {
+ if (length(name) > max_name_len) {
+ max_name_len = length(name)
+ }
+ }
+
+ max_balance_len = 0
+ for (name in accounts) {
+ for (u in accounts[name]) {
+ n = length(int(accounts[name][u]))
+ if (n > max_balance_len) {
+ max_balance_len = n
+ }
+ }
+ }
+ if (scale > 0) {
+ max_balance_len += length(".") + scale
+ }
+
+ for (name in accounts) {
+ for (u in accounts[name]) {
+ balance = accounts[name][u]
+ if (balance == 0) {
+ continue
+ }
+
+ fmt = "NAME BALANCE UNIT\n"
+
+ if (colorize) {
+ sub("BALANCE", "[" (balance < 0 ? 31 : 32) "m&", fmt)
+ }
+
+ sub("NAME", "%-" max_name_len "s", fmt)
+ sub("BALANCE", "%" max_balance_len "." scale "f", fmt)
+ sub("UNIT", "%s", fmt)
+
+ printf fmt, name, balance, u
+ }
+ }
+}
diff --git a/gold/mining/CONFIGURE b/gold/mining/CONFIGURE
new file mode 100644
index 00000000..299cbd53
--- /dev/null
+++ b/gold/mining/CONFIGURE
@@ -0,0 +1,8 @@
+How to Configure
+===============
+
+1. change the mining-url in ~/startup.sh
+2. in KDE - 'AMDOverdriveCtrl - configure profile
+3. in KDE-Autostart - activate the startup script
+2. sudo /etc/init.d/gdm restart
+
diff --git a/gold/mining/Makefile b/gold/mining/Makefile
new file mode 100644
index 00000000..8701920f
--- /dev/null
+++ b/gold/mining/Makefile
@@ -0,0 +1,20 @@
+.PHONY: all format install configure
+select-target:
+ @echo "You are made of stupid!"
+ echo "look here"
+ @cat Makefile
+format:
+ cat README
+fix-linucCoin: configure
+ apt-get install --yes lm-sensors tmux
+ echo '#!/bin/bash' > /usr/bin/ati_license
+ echo '#!/bin/sh' > /etc/init.d/live-boot
+ echo 'wall "going down"' >> /etc/init.d/live-boot
+ chmod 755 /etc/init.d/live-boot
+ echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license
+ cp -r user /home
+configure:
+ yes '' | sensors-detect
+ @cat CONFIGURE
+archlinux:
+ bin/archlinux-cruise-control
diff --git a/gold/mining/README b/gold/mining/README
new file mode 100644
index 00000000..ad8c3468
--- /dev/null
+++ b/gold/mining/README
@@ -0,0 +1,9 @@
+What to do:
+format the usb-stick:
+Device Boot Start End Blocks Id System
+/dev/sda1 * 1 254 976345 c W95 FAT32 (LBA)
+/dev/sda2 255 1017 2932972 83 Linux
+
+1. install coinlinux live system on sda1.
+2. mkfs.ext3 /dev/sda2 -L live-rw
+3. install grub on /dev/sda
diff --git a/gold/mining/TODO b/gold/mining/TODO
new file mode 100644
index 00000000..bafaa72a
--- /dev/null
+++ b/gold/mining/TODO
@@ -0,0 +1,2 @@
+- fix the sed script in "make archlinux" to replace only the first occurrence
+- test the amdoverdrive stuff from the home dir (user)
diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control
new file mode 100755
index 00000000..ba1c35da
--- /dev/null
+++ b/gold/mining/bin/archlinux-cruise-control
@@ -0,0 +1,75 @@
+#!/bin/bash
+set -euf
+export EDITOR=vim
+echo "!! ARCHLINUX Cruise Control Mining installer !!"
+echo "** adding main network profile"
+cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main
+echo 'POST_UP="cache=\"\$(cat /etc/resolv.conf)\"; echo \"\$cache\" | sed \"1i nameserver 8.8.8.8\" > /etc/resolv.conf"' >> /etc/network.d/main
+echo "** adding worker account"
+grep -q worker /etc/passwd || adduser worker
+gpasswd -a worker wheel
+gpasswd -a worker tty
+gpasswd -a worker audio
+gpasswd -a worker video
+gpasswd -a worker network
+gpasswd -a worker power
+
+echo "** adding archlinuxfr to pacman.conf"
+grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf
+echo "** installing all the required parts"
+pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers beep
+echo "** doing some tweaks"
+rm /usr/bin/python -f
+ln -s /usr/bin/python2 /usr/bin/python
+echo "syntax on" > /home/worker/.vimrc
+echo "syntax on" > /root/.vimrc
+echo "** installing tinc"
+[ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc
+cache="`cat /etc/sudoers`"
+echo "$cache" |
+sed 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' > /etc/sudoers
+echo "** Installing ATI drivers"
+[ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils
+[ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook
+[ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream
+echo "** installing X"
+pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim
+echo "** editing slim configuration"
+cache="`cat /etc/slim.conf`"
+echo "$cache" | sed '
+ s/.*default_user.*/default_user worker/
+ s/.*auto_login.*/auto_login yes/
+' > /etc/slim.conf
+echo "** Installing mining tools and overclocking stuff"
+[ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn
+echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!"
+[ "`yaourt -Q amdoverdrivectrl`" ] || yaourt -S amdoverdrivectrl
+echo "** copying bin folder"
+cp -r $(readlink -f `dirname $0`)/ /home/worker
+echo "** creating new .Xauthority for worker"
+sudo -u worker /home/worker/bin/newkey.sh
+mkdir -p /home/worker/.fluxbox
+cp /krebs/mining/user/startup.sh /home/worker/startup.sh
+chmod a+x /home/worker/startup.sh
+cp /krebs/mining/user/startup.sh /home/worker/.fluxbox/startup
+chmod a+x /home/worker/.fluxbox/startup
+cp /krebs/mining/user/mining.ovdr /home/worker/
+chown -R worker:users /home/worker
+echo "configuring X"
+echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter."
+echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here"
+echo "!! press enter to continue"
+lspci|grep VGA
+read
+aticonfig --initial=dual-head
+vim /etc/X11/xorg.conf
+echo "** creating xinitrc and sta