Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
CREATE OR REPLACE FUNCTION match_order (
left_id int
) RETURNS int AS $$
DECLARE
left "order"%ROWTYPE;
right "order"%ROWTYPE;
price bigint;
BEGIN
SELECT * INTO left FROM "order" o WHERE o.order_id = left_id;
DROP TABLE IF EXISTS "user" CASCADE;
DROP TABLE IF EXISTS match CASCADE;
DROP TABLE IF EXISTS transfer CASCADE;
DROP TABLE IF EXISTS currency CASCADE;
DROP TABLE IF EXISTS account CASCADE;
DROP TABLE IF EXISTS "order" CASCADE;
DROP DOMAIN IF EXISTS account_volume CASCADE;
DROP DOMAIN IF EXISTS order_price CASCADE;
DROP DOMAIN IF EXISTS order_volume CASCADE;
Bitcoin version v0.7.0-beta (2012-09-12 14:07:22 -0400)
Using OpenSSL version OpenSSL 1.0.1b 26 Apr 2012
Startup time: 11/09/12 08:27:30
Default data directory C:\Users\Andreas\AppData\Roaming\Bitcoin
Used data directory c:\temp\tnb\2\testnet3
Loading block index...
dbenv.open LogDir=c:\temp\tnb\2\testnet3\database ErrorFile=c:\temp\tnb\2\testnet3\db.log
LoadBlockIndex(): hashBestChain=000000000933ea01ad0e height=0 date=02/02/11 23:16:42
Verifying last 0 blocks at level 1
block index 27ms
[20:21:23] <+zapsoda> No
[20:21:25] <+zapsoda> Not that
[20:21:32] * +jcpham is eating leftover Cantonese duck
[20:21:37] <+jcpham> with plum sauce
[20:21:51] <+zapsoda> rg, It has to calculate the age in years from the birthdate then set the age colum to that :p
[23:21:59] * Disconnected
[07:44:27] * Attempting to rejoin channel #bitcoin-otc
[15:21:08] * Attempting to rejoin channel #bitcoin-otc
[16:46:08] * Unable to join channel (address is banned)
[16:47:22] * Unable to join channel (address is banned)
module.exports = function(scale) {
var last = null, repeat = 0;
scale || (scale = 2);
return function() {
var now = +new Date;
if (now == last) {
repeat++;
} else {
SELECT o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 0
GROUP BY o.price
ORDER BY o.price DESC
LIMIT 50
UNION ALL
SELECT o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 1
SELECT o,side, o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 0
GROUP BY o.price, o.side
ORDER BY o.price DESC
LIMIT 50
UNION ALL
SELECT o.side, o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 1
@abrkn
abrkn / gist:4077656
Created November 15, 2012 09:33
sassets - the shitty asset manager (in action)
app.get('/scripts.js', function(req, res, next) {
sassets.combine([
{ path: 'vendor/jquery 1.8.2/jquery-1.8.2.js' },
{ path: 'vendor/bootstrap 2.2.1/js/bootstrap.js' },
{ type: 'browserify', path: 'lib/client/entry.js', uglify: true }
], function(err, scripts) {
if (err) return next(err);
res.contentType('text/javascript');
res.end(scripts);
});
Backbone.wrapError = _.wrap(Backbone.wrapError, this.wrapError)
},
wrapError: function(inner, onError, originalModel, options) {
var onErrorWrap = function(model, xhr, options) {
xhr.body = JSON.parse(xhr.responseText) || xhr.responseText
if (!onError || !onError(model, xhr, options)) {
if (xhr.status == 401) {
app.session.forget()
PS C:\Users\Andreas> & 'C:\Program Files\PostgreSQL\9.2\bin\pg_dump.exe' -f c:\temp\snow.backup -U postgres -v snow
Password:
pg_dump: reading schemas
pg_dump: reading user-defined tables