Skip to content

Instantly share code, notes, and snippets.

Motivation

Locking down REST and/or JSON-RPC APIs in a generic way, with an object capability security model.

Proposed Design

Given some sort of priviliged access to a backend, this proxy would expose the service with no changes to the API apart from additional requirement for macaroon authorization.

A second mode would also be able to expose such a service to an unrestricted port, by statically configuring a macaroon to be submitted to an upstream endpoint, allowing hardened APIs to be exposed with no macaroon required.

@menugget
menugget / plot.stream.4.R
Last active February 25, 2019 18:46
Stream plot.
#plot.stream makes a "stream plot" where each y series is plotted
#as stacked filled polygons on alternating sides of a baseline.
#
#Arguments include:
#'x' - a vector of values
#'y' - a matrix of data series (columns) corresponding to x
#'order.method' = c("as.is", "max", "first")
# "as.is" - plot in order of y column
# "max" - plot in order of when each y series reaches maximum value
# "first" - plot in order of when each y series first value > 0
@rustyrussell
rustyrussell / permute-image.c
Created February 21, 2020 04:53
Quick code to scramble / unscramble an image given a key.
#include <ccan/array_size/array_size.h>
#include <ccan/asort/asort.h>
#include <ccan/crypto/sha256/sha256.h>
#include <ccan/err/err.h>
#include <ccan/str/hex/hex.h>
#include <ccan/short_types/short_types.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_pixels.h>
@carlj
carlj / rsa-encryption.md
Last active February 28, 2020 07:01
RSA large File En- and Decryption

RSA File De- and Encryption

Docu for encrypt and decrypt a large file with AES and RSA

Keypairs

Generate RSA Keypairs

//generates a private Key with 8196 Bit. 
openssl genrsa -out private.pem 8196
@spaceCamel
spaceCamel / NOTES.md
Last active March 20, 2020 17:20
PulseAudio + Bluetooth Headset

After updating the configuration

nixos-rebuild switch

I had to restart the system for pulseaudio to load the bluetooth module.

pactl list should show the bluetooth module.

As I'm not using a desktop-manager I've configured the device from the command line following ArchLinux instructions

@LnL7
LnL7 / find-fixed-outputs.nix
Last active March 29, 2020 00:57
Find fixed output derivations
# This expression returns a list of all fixed output derivations used by ‘expr’.
# eg.
# $ nix-instantiate find-fixed-outputs.nix --eval --strict --json --arg expr '(import <nixpkgs> {}).hello'
with import <nixpkgs> { };
with lib;
{ expr }:
let


  BIP&#58; ??? (tbr after sending to mailing list)
  Layer&#58; Applications
  Title&#58; Cipherseed – encrypted wallet seed
  Author&#58; Jonas Schnelli <dev@jonasschnelli.ch>
  Comments&#45;Summary&#58; No comments yet.
  Comments&#45;URI&#58; 
  Status&#58; Draft
  Type&#58; Standards Track
  Created&#58; 2018&#45;06&#45;04

@niftynei
niftynei / node_details.json
Created September 24, 2019 22:10
c-lightning Prometheus/Grafana Node Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@tonymorris
tonymorris / TypeClass.hs
Last active September 15, 2020 13:17
Type-class hierarchy
Moved to https://github.com/tonymorris/type-class
#!/usr/bin/env python3
import hashlib
import binascii
import os
from trezorlib import log
from trezorlib.client import TrezorClient
from trezorlib.transport import get_transport
from trezorlib.tools import parse_path