Skip to content

Instantly share code, notes, and snippets.

View masonforest's full-sized avatar

Mason Fischer masonforest

View GitHub Profile
@masonforest
masonforest / accounting.sql
Last active April 3, 2024 14:28 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL,
balance NUMERIC(20, 2) NOT NULL DEFAULT '0'
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
@masonforest
masonforest / Error R14
Created April 18, 2012 13:52
heroku logs --tail --app murfie |grep " Error R14"
heroku logs --tail --app murfie |grep " Error R14"
2012-04-18T13:46:26+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:35+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:49+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:55+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:11+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:15+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:33+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@masonforest
masonforest / main.rs
Last active October 16, 2020 17:35
Mining Future
#[macro_use]
extern crate lazy_static;
use async_std::task;
use rand::{
distributions::{Distribution, Standard},
Rng,
};
use std::{
future::Future,
pin::Pin,
[
{
"inputs": [],
"name": "emitEvent",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
@masonforest
masonforest / Dockerfile
Last active March 18, 2020 16:34
Test Drive Your Dockerfiles with RSpec and ServerSpec
FROM ubuntu:14.04
MAINTAINER Mason Fischer <mason@thoughtbot.com>
RUN apt-get update && apt-get install -y nodejs
➜ libsecp256k1 git:(master) rm -rf deps/ _build/
➜ libsecp256k1 git:(master) mix deps.get && mix compile
* Getting libsecp256k1_source (https://github.com/bitcoin-core/secp256k1.git)
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 4958 (delta 4), reused 9 (delta 2), pack-reused 4942
Receiving objects: 100% (4958/4958), 2.06 MiB | 3.08 MiB/s, done.
Resolving deltas: 100% (3462/3462), done.
Resolving Hex dependencies...
use crate::error;
use ellipticoin::{export, get_memory, sender, set_memory};
use wasm_rpc::Value;
use wasm_rpc::error::Error;
enum Namespace {
Balances,
}
#[export]
@masonforest
masonforest / deliver_email_matcher.rb
Created May 17, 2013 22:00
rspec matcher for ActionMailer rails email delivery
# Usage
# order = create(:order)
#
# expect {
# order.pay!
# }.to deliver_email(OrderMailer, :paid, order.id)
#
#
@masonforest
masonforest / smart_contract.js
Last active April 13, 2019 14:18
A Javascript class for interacting with smart contracts written for the [Perlin network](https://www.perlin.net/).
const crypto = require('crypto');
const { StringDecoder } = require("string_decoder");
const fs = require("fs");
const util = require('util');
const writeFile = util.promisify(fs.writeFile);
const readFile = util.promisify(fs.readFile);
const fileExists = util.promisify(fs.exists);
const _ = require("lodash");
const TRANSACTION_ID = new Uint8Array(256);
const ALICE = new Uint8Array(256).fill(1);