Skip to content

Instantly share code, notes, and snippets.


Andreas Brekken abrkn

View GitHub Profile
abrkn /
Created Apr 23, 2020
Print Heroku logs with pino-pretty
heroku logs -a YOUR_APP_NAME -t | sed 's/[^{]*//' | npx pino-pretty
#!/usr/bin/env bash
# Run database migrations with the power of bash
set -eu -o pipefail
cd "$(dirname "$0")/.."
if [ "$#" -lt 2 ]; then
1>&2 echo "Usage: $0 postgres://url/db <migration dir>"
exit 1
abrkn / drainTezosAccount.ts
Created Jul 4, 2020
Move the remaining balance of a Tezos account to the specified destination
View drainTezosAccount.ts
import * as Conseil from 'conseiljs';
import { SoftSigner } from 'conseiljs-softsigner';
import { ns } from '@sideshift/shared';
import {
} from '@sideshift/shared-node';
abrkn / ScreenCapture.cs
Created Jul 23, 2012
Captures the specified region of the a window to a System.Drawing.Bitmap.
View ScreenCapture.cs
using System;
using System.Drawing;
using System.Runtime.InteropServices;
public static class ScreenCapture
class NativeMethods
internal static extern IntPtr GetWindowDC(IntPtr hWnd);
abrkn / sql-tdd.markdown
Last active May 22, 2020
Migrations and testing for PostgreSQL using node.js and Travis-CI
View sql-tdd.markdown

Migrations and testing for PostgreSQL using node.js and Travis-CI

We're looking to add a column to the table user called admin (boolean) in an existing database.

Project layout

abrkn / demo.ts
Created May 1, 2020
Whitelist GraphQL introspection types returned by apollo-server
View demo.ts
import { middleware as whitelistMiddleware } from './utils/introspecton-whitelist';
import { whitelist as introspectionWhitelist } from './utils/introspecton-whitelist/whitelist';
// Your express app
// Whitelist GraphQL introspection responses
// Apollo middleware must be below whitelisting middleware
View Sweep.ts
import pMap from 'p-map';
import pRetry from 'p-retry';
import { safePromise } from 'safep';
import { chain, values, chunk, flatten } from 'lodash';
import { fromEnv as configFromEnv, SlpDepositConfig } from './config';
import { slpTokens } from '../shared/slp-tokens';
import { runWorkerUntilShutdown } from '../shared/utils-node';
import { getBitcoinRpc } from '../shared/rpcs';
import {
View liquid-asset-proof-d5a8a7af573c0bfa59584a0553f8899dfbcde9f7d839db85d187909fb70e2876
Authorize linking the domain name to the Liquid asset d5a8a7af573c0bfa59584a0553f8899dfbcde9f7d839db85d187909fb70e2876
abrkn / index.js
Created Oct 13, 2017
View index.js
#!/usr/bin/env node
const assert = require('assert');
const { delay } = require('bluebird');
const BigNumber = require('bignumber.js');
const kraken = require('./kraken');
const {