Skip to content

Instantly share code, notes, and snippets.

View paulbellamy's full-sized avatar

Paul Bellamy paulbellamy

View GitHub Profile
@paulbellamy
paulbellamy / cap-38-changes.markdown
Last active September 1, 2021 15:15 — forked from JakeUrban/sep10-changes
CAP-38 AMM Changes

We've just released v6.0.1, of the SDF Javascript base library.

It includes changes to implement CAP-38, supporting automated market makers.

These changes will be released with the protocol v18 upgrade.

There are some further notes on the changes API endpoints, with mock responses, on this APIary. Further notes on the API changes are available in this document.

  • Each SDK must update to enable depositing, and withdrawing from liquidity pools.
  • SDKs must also update to include the new effect types, as well as new fields on Accounts.
@paulbellamy
paulbellamy / [id].tsx
Created June 3, 2020 12:07
Next.js Apollo graphql page with server-side query
import { ApolloProvider, useQuery } from "@apollo/react-hooks";
import ApolloClient, { InMemoryCache } from "apollo-boost";
import { GraphQLError } from "graphql";
import { GetServerSideProps } from "next";
import { useRouter } from "next/router";
import wrap, { InitApolloClient, WithApolloProps } from "next-with-apollo";
// Add our query here. If we want this in a different file we could use
// graphql-codegen to parse that for us and generate documents and hooks.
import gql from "graphql-tag";
# ctrl-z on the prompt will resume last
# This means, from vim I can ctrl-z to the shell, and ctrl-z back again.
foreground-last() {
fg %
}
zle -N foreground-last
bindkey '^z' foreground-last
@paulbellamy
paulbellamy / prevdir.zsh
Created September 14, 2018 13:23
zsh widget to flip between last two directories with ctrl-e
prev_dir() {
zle push-line
cd -
zle reset-prompt
echo
zle get-line
}
zle -N prev-dir prev_dir
bindkey '^e' prev-dir
@paulbellamy
paulbellamy / z_selecta.zsh
Created September 14, 2018 13:18
Nice little utility to use selecta with zsh z plugin.
# if selecta is present, set that as the default behaviour of z command
if which ${_Z_CMD:-z} 2>&1 1>/dev/null && which selecta 2>&1 1>/dev/null; then
z_selecta() {
if [ $# -gt 0 ]; then
_z "$@" 2>&1
else
_z "$(_z |& awk '{print $2}' | selecta)" 2>&1
fi
}
alias ${_Z_CMD:-z}='z_selecta'
@paulbellamy
paulbellamy / git_annex
Last active August 29, 2015 14:17
git annex assistant rc.d script
#!/bin/sh
# /etc/rc.d/git_annex
# PROVIDE: git_annex
# REQUIRE: LOGIN FILESYSTEMS NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="git_annex"

Keybase proof

I hereby claim:

  • I am paulbellamy on github.
  • I am paulbellamy (https://keybase.io/paulbellamy) on keybase.
  • I have a public key whose fingerprint is 3E60 6446 06E5 A7DA 0E1E C190 F2F3 DFDF 2D4D 0C48

To claim this, I am signing this object:

@paulbellamy
paulbellamy / generate_master_key.go
Created December 1, 2014 11:45
Bitcoin Key Generator (broken)
//usr/bin/env go run $0 $@
package main
import (
"encoding/hex"
"flag"
"fmt"
"os"
"github.com/conformal/btcnet"
@paulbellamy
paulbellamy / gist:54d7d908d7ebce5bd2c0
Created June 23, 2014 08:43
How to lock up core.async
(import '[java.util.concurrent CountDownLatch])
(require '[clojure.core.async :as async])
(defn now []
(System/currentTimeMillis))
(defn waiter [i latch results]
(async/go
(swap! results conj [i :waiting (now)])
(.await latch) ;; Will block the thread
@paulbellamy
paulbellamy / ignores_sub-ssi.html
Created April 19, 2013 08:45
Trying to figure out how to do SSI includes on nginx. The first example renders 503 errors (from Haproxy) into the page, while the second example ignores ssi include statements present in ```/dynamic_partials/header```.
<!--# include virtual="/dynamic_partials/header" set="header" wait="yes" -->
<!--# if expr="$header" -->
<!--# echo var="header" encoding="none" -->
<!--# else -->
{% include logged_out_header.html %}
<!--# endif -->