From 9ac70dd23e89e32eff7a50ac43b2eda2e7f1e546 Mon Sep 17 00:00:00 2001 From: club-mate Date: Wed, 24 Aug 2011 03:12:23 +0200 Subject: evan: s/subliminal-messages/hackerethics/g --- evan/satz-liste | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/evan/satz-liste b/evan/satz-liste index 663aa572..bfdc8281 100644 --- a/evan/satz-liste +++ b/evan/satz-liste @@ -1,13 +1,8 @@ -wenn ich meinen erzeugten abfall vor dem nach hause gehen beseitige steigt mein soziales ansehen -bringe eine pflanze mit -ein sauberer scheck ist ein guter scheck -auch du weißt wie man den geschirrspüler einräumt -wer die toilette putzt kommt in den himmel -der große bruder sieht es gerne wenn die genossen die vereinsräume in stand halten -muelltrennung bringt gutes karma -dokumentiere deine projekte -werbe neue mitglieder -fnord -bewässere die Pflanzen -Öffne ein Fenster -wische die tische +Der Zugang zu Computern und allem, was einem zeigen kann, wie diese Welt funktioniert, sollte unbegrenzt und vollständig sein. +Alle Informationen müssen frei sein. +Mißtraue Autoritäten - fördere Dezentralisierung +Beurteile einen Hacker nach dem, was er tut und nicht nach üblichen Kriterien wie Aussehen, Alter, Rasse, Geschlecht oder gesellschaftlicher Stellung. +Man kann mit einem Computer Kunst und Schönheit schaffen. +Computer können dein Leben zum Besseren verändern. +Mülle nicht in den Daten anderer Leute. +Öffentliche Daten nützen, private Daten schützen -- cgit v1.2.3 From f95f9e6cd98733ba0859bb5c9ffd230d02c6cf1e Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 11:50:20 +0200 Subject: cholerab thesauron: add Nahziel{,erfahrung} --- cholerab/thesauron | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cholerab/thesauron diff --git a/cholerab/thesauron b/cholerab/thesauron new file mode 100644 index 00000000..32a70eb2 --- /dev/null +++ b/cholerab/thesauron @@ -0,0 +1,6 @@ +Nahziel n. +- Ziel mit höchst möglicher Priorität. + +Nahzielerfahrung n. +- das Erlebnis der (endgültigen) Nichterreichung eines Nahziels (obwohl + nur noch wenig ((quasi-) infinitesimal viel) nötig gewesen wäre). -- cgit v1.2.3 From 9b690c98416754b920626926c3511cfad53c0887 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 25 Aug 2011 03:18:47 +0300 Subject: cholerab/thesauron: add Cholerab - multiple descriptions --- cholerab/thesauron | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cholerab/thesauron b/cholerab/thesauron index 32a70eb2..a0b54543 100644 --- a/cholerab/thesauron +++ b/cholerab/thesauron @@ -4,3 +4,8 @@ Nahziel n. Nahzielerfahrung n. - das Erlebnis der (endgültigen) Nichterreichung eines Nahziels (obwohl nur noch wenig ((quasi-) infinitesimal viel) nötig gewesen wäre). + +Cholerab n. +- 1. Kunstwort aus Kollaboration und Cholera. Beschreibt den Zustand, dass + Zusammenarbeit niemals gut, einfach und ohne Schmerzen funktioniert +- 2. Teamwork Plattform fuer Krebscode \ No newline at end of file -- cgit v1.2.3 From e7a148349ef3e1e4e1607fd29148bec51dc4ed82 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 15:23:26 +0200 Subject: cholerab thesauron: Fix typos and order of Cholerab --- cholerab/thesauron | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cholerab/thesauron b/cholerab/thesauron index a0b54543..07e274f5 100644 --- a/cholerab/thesauron +++ b/cholerab/thesauron @@ -1,11 +1,11 @@ +Cholerab n. +- Kunstwort aus Kollaboration und Cholera. Beschreibt den Zustand, dass + Zusammenarbeit niemals gut, einfach und ohne Schmerzen funktioniert. +- Teamwork-Plattform für Krebscode. + Nahziel n. - Ziel mit höchst möglicher Priorität. Nahzielerfahrung n. - das Erlebnis der (endgültigen) Nichterreichung eines Nahziels (obwohl nur noch wenig ((quasi-) infinitesimal viel) nötig gewesen wäre). - -Cholerab n. -- 1. Kunstwort aus Kollaboration und Cholera. Beschreibt den Zustand, dass - Zusammenarbeit niemals gut, einfach und ohne Schmerzen funktioniert -- 2. Teamwork Plattform fuer Krebscode \ No newline at end of file -- cgit v1.2.3 From c37ab9c4accc58919e87ad4eee1ef19f49eed873 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 16:45:00 +0200 Subject: {btc -> gold} SC & co., we're ready --- btc/btcguild/index.js | 20 ------- btc/mining/CONFIGURE | 8 --- btc/mining/Makefile | 20 ------- btc/mining/README | 9 --- btc/mining/TODO | 2 - btc/mining/bin/archlinux-cruise-control | 70 ---------------------- btc/mining/bin/ati_temper | 5 -- btc/mining/bin/cleanup_tmp | 4 -- btc/mining/bin/ensure-router | 36 ----------- btc/mining/bin/ensure-wlan0 | 41 ------------- btc/mining/poll_btcguild | 2 - btc/mining/user/.config/autostart/startup.desktop | 6 -- btc/mining/user/mining.ovdr | 16 ----- btc/mining/user/startup.sh | 13 ---- btc/mtgox/json_ticker_helper.py | 7 --- btc/mtgox/mtgox.getDepth | 3 - btc/mtgox/mtgox.getTrades | 3 - btc/mtgox/mtgox.ticker | 4 -- btc/mtgox/ticker_text.sh | 3 - gold/btcguild/index.js | 20 +++++++ gold/mining/CONFIGURE | 8 +++ gold/mining/Makefile | 20 +++++++ gold/mining/README | 9 +++ gold/mining/TODO | 2 + gold/mining/bin/archlinux-cruise-control | 70 ++++++++++++++++++++++ gold/mining/bin/ati_temper | 5 ++ gold/mining/bin/cleanup_tmp | 4 ++ gold/mining/bin/ensure-router | 36 +++++++++++ gold/mining/bin/ensure-wlan0 | 41 +++++++++++++ gold/mining/poll_btcguild | 2 + gold/mining/user/.config/autostart/startup.desktop | 6 ++ gold/mining/user/mining.ovdr | 16 +++++ gold/mining/user/startup.sh | 13 ++++ gold/mtgox/json_ticker_helper.py | 7 +++ gold/mtgox/mtgox.getDepth | 3 + gold/mtgox/mtgox.getTrades | 3 + gold/mtgox/mtgox.ticker | 4 ++ gold/mtgox/ticker_text.sh | 3 + 38 files changed, 272 insertions(+), 272 deletions(-) delete mode 100644 btc/btcguild/index.js delete mode 100644 btc/mining/CONFIGURE delete mode 100644 btc/mining/Makefile delete mode 100644 btc/mining/README delete mode 100644 btc/mining/TODO delete mode 100755 btc/mining/bin/archlinux-cruise-control delete mode 100755 btc/mining/bin/ati_temper delete mode 100755 btc/mining/bin/cleanup_tmp delete mode 100755 btc/mining/bin/ensure-router delete mode 100755 btc/mining/bin/ensure-wlan0 delete mode 100644 btc/mining/poll_btcguild delete mode 100644 btc/mining/user/.config/autostart/startup.desktop delete mode 100644 btc/mining/user/mining.ovdr delete mode 100755 btc/mining/user/startup.sh delete mode 100755 btc/mtgox/json_ticker_helper.py delete mode 100755 btc/mtgox/mtgox.getDepth delete mode 100755 btc/mtgox/mtgox.getTrades delete mode 100755 btc/mtgox/mtgox.ticker delete mode 100755 btc/mtgox/ticker_text.sh create mode 100644 gold/btcguild/index.js create mode 100644 gold/mining/CONFIGURE create mode 100644 gold/mining/Makefile create mode 100644 gold/mining/README create mode 100644 gold/mining/TODO create mode 100755 gold/mining/bin/archlinux-cruise-control create mode 100755 gold/mining/bin/ati_temper create mode 100755 gold/mining/bin/cleanup_tmp create mode 100755 gold/mining/bin/ensure-router create mode 100755 gold/mining/bin/ensure-wlan0 create mode 100644 gold/mining/poll_btcguild create mode 100644 gold/mining/user/.config/autostart/startup.desktop create mode 100644 gold/mining/user/mining.ovdr create mode 100755 gold/mining/user/startup.sh create mode 100755 gold/mtgox/json_ticker_helper.py create mode 100755 gold/mtgox/mtgox.getDepth create mode 100755 gold/mtgox/mtgox.getTrades create mode 100755 gold/mtgox/mtgox.ticker create mode 100755 gold/mtgox/ticker_text.sh diff --git a/btc/btcguild/index.js b/btc/btcguild/index.js deleted file mode 100644 index 1f33db06..00000000 --- a/btc/btcguild/index.js +++ /dev/null @@ -1,20 +0,0 @@ -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/btc/mining/CONFIGURE b/btc/mining/CONFIGURE deleted file mode 100644 index 299cbd53..00000000 --- a/btc/mining/CONFIGURE +++ /dev/null @@ -1,8 +0,0 @@ -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/btc/mining/Makefile b/btc/mining/Makefile deleted file mode 100644 index 8701920f..00000000 --- a/btc/mining/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -.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/btc/mining/README b/btc/mining/README deleted file mode 100644 index ad8c3468..00000000 --- a/btc/mining/README +++ /dev/null @@ -1,9 +0,0 @@ -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/btc/mining/TODO b/btc/mining/TODO deleted file mode 100644 index bafaa72a..00000000 --- a/btc/mining/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- 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/btc/mining/bin/archlinux-cruise-control b/btc/mining/bin/archlinux-cruise-control deleted file mode 100755 index de5a0fa4..00000000 --- a/btc/mining/bin/archlinux-cruise-control +++ /dev/null @@ -1,70 +0,0 @@ -#!/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="sed -i \"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 -sed -i -e '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" -sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf -sed -i '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 start x" -echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc -echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc -echo '/home/worker/startup.sh &' >> /home/worker/.xinitrc -echo 'xterm &' >> /home/worker/.xinitrc -echo 'exec fluxbox' >> /home/worker/.xinitrc -echo '!! start x with `xinit `' -echo 'add "x:5:respawn:/usr/bin/slim >/dev/null 2>&1" to /etc/inittab to start slim" - - diff --git a/btc/mining/bin/ati_temper b/btc/mining/bin/ati_temper deleted file mode 100755 index 283a6024..00000000 --- a/btc/mining/bin/ati_temper +++ /dev/null @@ -1,5 +0,0 @@ -#displays: CARD1TEMP CARD2TEMP CPUTEMP OUTSIDE -echo -n "`DISPLAY=:0 aticonfig --adapter=1 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " -echo -n "`DISPLAY=:0 aticonfig --adapter=2 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " -echo -n "`sensors | grep temp1 | sed -e 's/temp1: *+\([0-9.]*\).*/\1/'` " -echo "`temper`" diff --git a/btc/mining/bin/cleanup_tmp b/btc/mining/bin/cleanup_tmp deleted file mode 100755 index e1395b19..00000000 --- a/btc/mining/bin/cleanup_tmp +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -ls -lAtr /tmp/ | sed -rn ' - /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} -' | sudo sh diff --git a/btc/mining/bin/ensure-router b/btc/mining/bin/ensure-router deleted file mode 100755 index 5eedabc9..00000000 --- a/btc/mining/bin/ensure-router +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh - -if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - -if=eth2 - -rc() { - for x in /etc/init.d/$1 /etc/rc.d/$1; do - if test -x $x; then - $x restart - break - fi - done -} - -if ! ifconfig $if | grep -q 'inet addr'; then - beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : - beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : - beep -l 50 -f 2500; rc dnsmasq restart - beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE - beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE - if ifconfig $if | grep -q 'inet addr'; then - beep -l 50 -f 2500 -n -l 100 -f 3000 - else - beep -l 50 -f 2500 -n -l 100 -f 1000 - fi -else - case "${1-}" in - (--quiet) : ;; - (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;; - esac -fi diff --git a/btc/mining/bin/ensure-wlan0 b/btc/mining/bin/ensure-wlan0 deleted file mode 100755 index fa92c4f5..00000000 --- a/btc/mining/bin/ensure-wlan0 +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh - -if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo -E "$0" "$@" - exit 23 # go to hell -fi - -has_internet() { - curl -sS google.com >/dev/null -} - -if test "${force-false}" = true || ! has_internet; then - - ## get rid of the fuckers - for fucker in NetworkManager nm-applet; do - pkill -9 $fucker - (IFS=:; for dir in $PATH; do rm -vf $dir/$fucker; done) - done - - beep -l 50 -f 2000; pkill wpa - beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* - beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & - while ! wpa_cli status | grep -q wpa_state=COMPLETED; do - beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 - sleep 1 - done - beep -l 50 -f 2000; dhcpcd -x wlan0 - beep -l 50 -f 2000; dhcpcd wlan0 - #echo nameserver 8.8.8.8 >/etc/resolv.conf - if has_internet; then - beep -l 50 -f 2000 -n -l 100 -f 3000 - else - beep -l 50 -f 2000 -n -l 100 -f 1000 - fi -else - case "${1-}" in - (--quiet) : ;; - (*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;; - esac -fi diff --git a/btc/mining/poll_btcguild b/btc/mining/poll_btcguild deleted file mode 100644 index 92a02657..00000000 --- a/btc/mining/poll_btcguild +++ /dev/null @@ -1,2 +0,0 @@ -API_KEY= -curl http://www.btcguild.com/api.php\?api_key\=${API_KEY} | python -mjson.tool diff --git a/btc/mining/user/.config/autostart/startup.desktop b/btc/mining/user/.config/autostart/startup.desktop deleted file mode 100644 index 67c35ef8..00000000 --- a/btc/mining/user/.config/autostart/startup.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Name=LXDE Autostart -Exec=/home/user/startup.sh -Terminal=true -Type=Application -Categories=Configuration diff --git a/btc/mining/user/mining.ovdr b/btc/mining/user/mining.ovdr deleted file mode 100644 index d6cf6fec..00000000 --- a/btc/mining/user/mining.ovdr +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/btc/mining/user/startup.sh b/btc/mining/user/startup.sh deleted file mode 100755 index 6274a892..00000000 --- a/btc/mining/user/startup.sh +++ /dev/null @@ -1,13 +0,0 @@ -sudo pkill tmux -sleep 5 -source ~/.profile -export DISPLAY=:0 -export URL="${URL-http://txgen_chinaman:lolwut@uk.btcguild.com:8332}" -#export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334" -tmux start-server -tmux new-session -d -s mining -n mining -tmux new-window -t mining:1 'cd ~;AMDOverdriveCtrl -i 0 mining.ovdr' -tmux new-window -t mining:2 'cd ~;AMDOverdriveCtrl -i 3 mining.ovdr' -sleep 5 -tmux new-window -t mining:3 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" -tmux new-window -t mining:4 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" diff --git a/btc/mtgox/json_ticker_helper.py b/btc/mtgox/json_ticker_helper.py deleted file mode 100755 index 727dd594..00000000 --- a/btc/mtgox/json_ticker_helper.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/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/btc/mtgox/mtgox.getDepth b/btc/mtgox/mtgox.getDepth deleted file mode 100755 index 9a607979..00000000 --- a/btc/mtgox/mtgox.getDepth +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# get mtgox market depth -$ curl -ksS https://mtgox.com/code/data/getDepth.php diff --git a/btc/mtgox/mtgox.getTrades b/btc/mtgox/mtgox.getTrades deleted file mode 100755 index 73e5a68d..00000000 --- a/btc/mtgox/mtgox.getTrades +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# get mtgox last trades -$ curl -ksS https://mtgox.com/code/data/getTrades.phl diff --git a/btc/mtgox/mtgox.ticker b/btc/mtgox/mtgox.ticker deleted file mode 100755 index b24dfb35..00000000 --- a/btc/mtgox/mtgox.ticker +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -# get mtgox ticker data -set -euf -curl -ksS https://mtgox.com/code/data/ticker.php diff --git a/btc/mtgox/ticker_text.sh b/btc/mtgox/ticker_text.sh deleted file mode 100755 index 2bcac134..00000000 --- a/btc/mtgox/ticker_text.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -dirname=`dirname $(readlink -f $0)` -$dirname/mtgox.ticker | python $dirname/json_ticker_helper.py 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/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..de5a0fa4 --- /dev/null +++ b/gold/mining/bin/archlinux-cruise-control @@ -0,0 +1,70 @@ +#!/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="sed -i \"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 +sed -i -e '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" +sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf +sed -i '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 start x" +echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc +echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc +echo '/home/worker/startup.sh &' >> /home/worker/.xinitrc +echo 'xterm &' >> /home/worker/.xinitrc +echo 'exec fluxbox' >> /home/worker/.xinitrc +echo '!! start x with `xinit `' +echo 'add "x:5:respawn:/usr/bin/slim >/dev/null 2>&1" to /etc/inittab to start slim" + + diff --git a/gold/mining/bin/ati_temper b/gold/mining/bin/ati_temper new file mode 100755 index 00000000..283a6024 --- /dev/null +++ b/gold/mining/bin/ati_temper @@ -0,0 +1,5 @@ +#displays: CARD1TEMP CARD2TEMP CPUTEMP OUTSIDE +echo -n "`DISPLAY=:0 aticonfig --adapter=1 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`DISPLAY=:0 aticonfig --adapter=2 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`sensors | grep temp1 | sed -e 's/temp1: *+\([0-9.]*\).*/\1/'` " +echo "`temper`" diff --git a/gold/mining/bin/cleanup_tmp b/gold/mining/bin/cleanup_tmp new file mode 100755 index 00000000..e1395b19 --- /dev/null +++ b/gold/mining/bin/cleanup_tmp @@ -0,0 +1,4 @@ +#! /bin/sh +ls -lAtr /tmp/ | sed -rn ' + /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} +' | sudo sh diff --git a/gold/mining/bin/ensure-router b/gold/mining/bin/ensure-router new file mode 100755 index 00000000..5eedabc9 --- /dev/null +++ b/gold/mining/bin/ensure-router @@ -0,0 +1,36 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +if=eth2 + +rc() { + for x in /etc/init.d/$1 /etc/rc.d/$1; do + if test -x $x; then + $x restart + break + fi + done +} + +if ! ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : + beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : + beep -l 50 -f 2500; rc dnsmasq restart + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE + if ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500 -n -l 100 -f 3000 + else + beep -l 50 -f 2500 -n -l 100 -f 1000 + fi +else + case "${1-}" in + (--quiet) : ;; + (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;; + esac +fi diff --git a/gold/mining/bin/ensure-wlan0 b/gold/mining/bin/ensure-wlan0 new file mode 100755 index 00000000..fa92c4f5 --- /dev/null +++ b/gold/mining/bin/ensure-wlan0 @@ -0,0 +1,41 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo -E "$0" "$@" + exit 23 # go to hell +fi + +has_internet() { + curl -sS google.com >/dev/null +} + +if test "${force-false}" = true || ! has_internet; then + + ## get rid of the fuckers + for fucker in NetworkManager nm-applet; do + pkill -9 $fucker + (IFS=:; for dir in $PATH; do rm -vf $dir/$fucker; done) + done + + beep -l 50 -f 2000; pkill wpa + beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* + beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & + while ! wpa_cli status | grep -q wpa_state=COMPLETED; do + beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 + sleep 1 + done + beep -l 50 -f 2000; dhcpcd -x wlan0 + beep -l 50 -f 2000; dhcpcd wlan0 + #echo nameserver 8.8.8.8 >/etc/resolv.conf + if has_internet; then + beep -l 50 -f 2000 -n -l 100 -f 3000 + else + beep -l 50 -f 2000 -n -l 100 -f 1000 + fi +else + case "${1-}" in + (--quiet) : ;; + (*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;; + esac +fi diff --git a/gold/mining/poll_btcguild b/gold/mining/poll_btcguild new file mode 100644 index 00000000..92a02657 --- /dev/null +++ b/gold/mining/poll_btcguild @@ -0,0 +1,2 @@ +API_KEY= +curl http://www.btcguild.com/api.php\?api_key\=${API_KEY} | python -mjson.tool diff --git a/gold/mining/user/.config/autostart/startup.desktop b/gold/mining/user/.config/autostart/startup.desktop new file mode 100644 index 00000000..67c35ef8 --- /dev/null +++ b/gold/mining/user/.config/autostart/startup.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=LXDE Autostart +Exec=/home/user/startup.sh +Terminal=true +Type=Application +Categories=Configuration diff --git a/gold/mining/user/mining.ovdr b/gold/mining/user/mining.ovdr new file mode 100644 index 00000000..d6cf6fec --- /dev/null +++ b/gold/mining/user/mining.ovdr @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/gold/mining/user/startup.sh b/gold/mining/user/startup.sh new file mode 100755 index 00000000..6274a892 --- /dev/null +++ b/gold/mining/user/startup.sh @@ -0,0 +1,13 @@ +sudo pkill tmux +sleep 5 +source ~/.profile +export DISPLAY=:0 +export URL="${URL-http://txgen_chinaman:lolwut@uk.btcguild.com:8332}" +#export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334" +tmux start-server +tmux new-session -d -s mining -n mining +tmux new-window -t mining:1 'cd ~;AMDOverdriveCtrl -i 0 mining.ovdr' +tmux new-window -t mining:2 'cd ~;AMDOverdriveCtrl -i 3 mining.ovdr' +sleep 5 +tmux new-window -t mining:3 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" +tmux new-window -t mining:4 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" diff --git a/gold/mtgox/json_ticker_helper.py b/gold/mtgox/json_ticker_helper.py new file mode 100755 index 00000000..727dd594 --- /dev/null +++ b/gold/mtgox/json_ticker_helper.py @@ -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/mtgox/mtgox.getDepth b/gold/mtgox/mtgox.getDepth new file mode 100755 index 00000000..9a607979 --- /dev/null +++ b/gold/mtgox/mtgox.getDepth @@ -0,0 +1,3 @@ +#! /bin/sh +# get mtgox market depth +$ curl -ksS https://mtgox.com/code/data/getDepth.php diff --git a/gold/mtgox/mtgox.getTrades b/gold/mtgox/mtgox.getTrades new file mode 100755 index 00000000..73e5a68d --- /dev/null +++ b/gold/mtgox/mtgox.getTrades @@ -0,0 +1,3 @@ +#! /bin/sh +# get mtgox last trades +$ curl -ksS https://mtgox.com/code/data/getTrades.phl diff --git a/gold/mtgox/mtgox.ticker b/gold/mtgox/mtgox.ticker new file mode 100755 index 00000000..b24dfb35 --- /dev/null +++ b/gold/mtgox/mtgox.ticker @@ -0,0 +1,4 @@ +#! /bin/sh +# get mtgox ticker data +set -euf +curl -ksS https://mtgox.com/code/data/ticker.php diff --git a/gold/mtgox/ticker_text.sh b/gold/mtgox/ticker_text.sh new file mode 100755 index 00000000..2bcac134 --- /dev/null +++ b/gold/mtgox/ticker_text.sh @@ -0,0 +1,3 @@ +#!/bin/sh +dirname=`dirname $(readlink -f $0)` +$dirname/mtgox.ticker | python $dirname/json_ticker_helper.py -- cgit v1.2.3 From 0ec11733c539e69b1e035585f9e44de19198d93a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 16:50:00 +0200 Subject: gold scex: initial commit --- gold/scex/index.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ gold/scex/slurp.js | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 gold/scex/index.js create mode 100644 gold/scex/slurp.js diff --git a/gold/scex/index.js b/gold/scex/index.js new file mode 100644 index 00000000..e0c706e7 --- /dev/null +++ b/gold/scex/index.js @@ -0,0 +1,58 @@ +var http = require('http'); +var slurp = require('./slurp'); + +var options = { + host: 'scexchange.bitparking.com', + port: 8080, + path: '/api/t2' +}; + +var last_id = 0; +var last_price = 0; +function t2 () { + http.get(options, function(res) { + slurp(res, function (data) { + try { + data = JSON.parse(data); + } catch (exn) { + return console.error('' + exn.stack + ''); + }; + data + .sort(function (a, b) { + return a.id - b.id; + }) + .forEach(function (x) { + if (x.id > last_id) { + last_id = x.id; + + x.date = new Date(Number(x.date) * 1000); + + var price = x.price.toString(); + while (price.length < 'x.xxxxxxxx'.length) { + price += 0; + } + if (x.price > last_price) { + price = '' + price + '' + } + if (x.price < last_price) { + price = '' + price + '' + } + last_price = x.price; + + var c = ({ buy: '', sell: '' })[x.type]; + var m = ''; + m += x.id + m += ' ' + JSON.parse(JSON.stringify(x.date)) + m += ' ' + price + m += ' ' + c + x.amount + '' + console.log(m); + + }; + }); + }); + }).on('error', function(e) { + console.log("Got error: " + e.message); + }); +}; + +setInterval(t2, 1000); diff --git a/gold/scex/slurp.js b/gold/scex/slurp.js new file mode 100644 index 00000000..70319743 --- /dev/null +++ b/gold/scex/slurp.js @@ -0,0 +1,38 @@ +module.exports = (function () { + + function join_buffers (buffers, length) { + var buffer = new Buffer(length); + var targetStart = 0; + buffers.forEach(function (x) { + x.copy(buffer, targetStart); + targetStart += x.length; + }); + return buffer; + }; + + function finish_it (req, buffers, length, callback) { + req.content = join_buffers(buffers, length); + return callback(req.content); + }; + + function nop () {}; + + return function (req, callback) { + if (req.hasOwnProperty('content')) { + return callback(req.content); + }; + var content = []; + var length = 0; + var end_handler = finish_it; + req.on('data', function (data) { + content.push(data); + length += data.length; + }); + [ 'end', 'close' ].forEach(function (event) { + req.on(event, function () { + finish_it(req, content, length, callback); + end_handler = nop; + }); + }); + }; +})(); -- cgit v1.2.3 From b35a8971a9e1fa904db4356cb28fc4cd648134d3 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 17:01:38 +0200 Subject: gold: add scex ticker_text.sh --- gold/json/render/ticker | 7 +++++++ gold/mtgox/json_ticker_helper.py | 7 ------- gold/mtgox/ticker_text.sh | 7 ++++--- gold/scex/ticker | 2 ++ gold/scex/ticker_text.sh | 4 ++++ 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100755 gold/json/render/ticker delete mode 100755 gold/mtgox/json_ticker_helper.py create mode 100755 gold/scex/ticker create mode 100755 gold/scex/ticker_text.sh 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/mtgox/json_ticker_helper.py b/gold/mtgox/json_ticker_helper.py deleted file mode 100755 index 727dd594..00000000 --- a/gold/mtgox/json_ticker_helper.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/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/mtgox/ticker_text.sh b/gold/mtgox/ticker_text.sh index 2bcac134..f585ffea 100755 --- a/gold/mtgox/ticker_text.sh +++ b/gold/mtgox/ticker_text.sh @@ -1,3 +1,4 @@ -#!/bin/sh -dirname=`dirname $(readlink -f $0)` -$dirname/mtgox.ticker | python $dirname/json_ticker_helper.py +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./mtgox.ticker | ../json/render/ticker diff --git a/gold/scex/ticker b/gold/scex/ticker new file mode 100755 index 00000000..a95d5910 --- /dev/null +++ b/gold/scex/ticker @@ -0,0 +1,2 @@ +#! /bin/sh +exec curl -ksS http://scexchange.bitparking.com:8080/api/ticker diff --git a/gold/scex/ticker_text.sh b/gold/scex/ticker_text.sh new file mode 100755 index 00000000..fbaff55b --- /dev/null +++ b/gold/scex/ticker_text.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./ticker | ../json/render/ticker -- cgit v1.2.3 From 7c18a3d4e5897adb4ddd141aed261ce63daf1a10 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Aug 2011 17:05:23 +0200 Subject: gold: move tracer to own subdir --- gold/scex/index.js | 58 ----------------------------------------------- gold/scex/slurp.js | 38 ------------------------------- gold/scex/tracer/index.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++ gold/scex/tracer/slurp.js | 38 +++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 96 deletions(-) delete mode 100644 gold/scex/index.js delete mode 100644 gold/scex/slurp.js create mode 100644 gold/scex/tracer/index.js create mode 100644 gold/scex/tracer/slurp.js diff --git a/gold/scex/index.js b/gold/scex/index.js deleted file mode 100644 index e0c706e7..00000000 --- a/gold/scex/index.js +++ /dev/null @@ -1,58 +0,0 @@ -var http = require('http'); -var slurp = require('./slurp'); - -var options = { - host: 'scexchange.bitparking.com', - port: 8080, - path: '/api/t2' -}; - -var last_id = 0; -var last_price = 0; -function t2 () { - http.get(options, function(res) { - slurp(res, function (data) { - try { - data = JSON.parse(data); - } catch (exn) { - return console.error('' + exn.stack + ''); - }; - data - .sort(function (a, b) { - return a.id - b.id; - }) - .forEach(function (x) { - if (x.id > last_id) { - last_id = x.id; - - x.date = new Date(Number(x.date) * 1000); - - var price = x.price.toString(); - while (price.length < 'x.xxxxxxxx'.length) { - price += 0; - } - if (x.price > last_price) { - price = '' + price + '' - } - if (x.price < last_price) { - price = '' + price + '' - } - last_price = x.price; - - var c = ({ buy: '', sell: '' })[x.type]; - var m = ''; - m += x.id - m += ' ' + JSON.parse(JSON.stringify(x.date)) - m += ' ' + price - m += ' ' + c + x.amount + '' - console.log(m); - - }; - }); - }); - }).on('error', function(e) { - console.log("Got error: " + e.message); - }); -}; - -setInterval(t2, 1000); diff --git a/gold/scex/slurp.js b/gold/scex/slurp.js deleted file mode 100644 index 70319743..00000000 --- a/gold/scex/slurp.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = (function () { - - function join_buffers (buffers, length) { - var buffer = new Buffer(length); - var targetStart = 0; - buffers.forEach(function (x) { - x.copy(buffer, targetStart); - targetStart += x.length; - }); - return buffer; - }; - - function finish_it (req, buffers, length, callback) { - req.content = join_buffers(buffers, length); - return callback(req.content); - }; - - function nop () {}; - - return function (req, callback) { - if (req.hasOwnProperty('content')) { - return callback(req.content); - }; - var content = []; - var length = 0; - var end_handler = finish_it; - req.on('data', function (data) { - content.push(data); - length += data.length; - }); - [ 'end', 'close' ].forEach(function (event) { - req.on(event, function () { - finish_it(req, content, length, callback); - end_handler = nop; - }); - }); - }; -})(); diff --git a/gold/scex/tracer/index.js b/gold/scex/tracer/index.js new file mode 100644 index 00000000..e0c706e7 --- /dev/null +++ b/gold/scex/tracer/index.js @@ -0,0 +1,58 @@ +var http = require('http'); +var slurp = require('./slurp'); + +var options = { + host: 'scexchange.bitparking.com', + port: 8080, + path: '/api/t2' +}; + +var last_id = 0; +var last_price = 0; +function t2 () { + http.get(options, function(res) { + slurp(res, function (data) { + try { + data = JSON.parse(data); + } catch (exn) { + return console.error('' + exn.stack + ''); + }; + data + .sort(function (a, b) { + return a.id - b.id; + }) + .forEach(function (x) { + if (x.id > last_id) { + last_id = x.id; + + x.date = new Date(Number(x.date) * 1000); + + var price = x.price.toString(); + while (price.length < 'x.xxxxxxxx'.length) { + price += 0; + } + if (x.price > last_price) { + price = '' + price + '' + } + if (x.price < last_price) { + price = '' + price + '' + } + last_price = x.price; + + var c = ({ buy: '', sell: '' })[x.type]; + var m = ''; + m += x.id + m += ' ' + JSON.parse(JSON.stringify(x.date)) + m += ' ' + price + m += ' ' + c + x.amount + '' + console.log(m); + + }; + }); + }); + }).on('error', function(e) { + console.log("Got error: " + e.message); + }); +}; + +setInterval(t2, 1000); diff --git a/gold/scex/tracer/slurp.js b/gold/scex/tracer/slurp.js new file mode 100644 index 00000000..70319743 --- /dev/null +++ b/gold/scex/tracer/slurp.js @@ -0,0 +1,38 @@ +module.exports = (function () { + + function join_buffers (buffers, length) { + var buffer = new Buffer(length); + var targetStart = 0; + buffers.forEach(function (x) { + x.copy(buffer, targetStart); + targetStart += x.length; + }); + return buffer; + }; + + function finish_it (req, buffers, length, callback) { + req.content = join_buffers(buffers, length); + return callback(req.content); + }; + + function nop () {}; + + return function (req, callback) { + if (req.hasOwnProperty('content')) { + return callback(req.content); + }; + var content = []; + var length = 0; + var end_handler = finish_it; + req.on('data', function (data) { + content.push(data); + length += data.length; + }); + [ 'end', 'close' ].forEach(function (event) { + req.on(event, function () { + finish_it(req, content, length, callback); + end_handler = nop; + }); + }); + }; +})(); -- cgit v1.2.3