Skip to content

Instantly share code, notes, and snippets.

View AljoschaMeyer's full-sized avatar

Aljoscha Meyer AljoschaMeyer

View GitHub Profile
@AljoschaMeyer
AljoschaMeyer / script.sh
Created March 14, 2016 11:07
Quick markdow preview in the browser using remarkable. Usage: `script.sh input.md output.html`
(echo -n '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Markdown</title>
<link rel="stylesheet" href="' && echo -n ~/md2html/style.css && echo '">
</head>
<body>' && remarkable $1 && echo ' </body>
</html>
') > $2
@AljoschaMeyer
AljoschaMeyer / snippets.cson
Last active July 30, 2016 12:57
Example for adding lilypond snippets in atom
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@AljoschaMeyer
AljoschaMeyer / framework.xml
Created August 11, 2016 12:27
example output java asg plugin
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="ASCII"?>
<javagraphs:JavaASG xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javagraphs="http://aljoscha-meyer.de/javagraphs/javagraphs/asg">
<allPackageBindings Name="asgframework.asgClassGeneration" referringNames="//@allCompilationUnits.0/@Package/@Name //@allCompilationUnits.0/@Package/@Name/@Name //@allCompilationUnits.9/@Package/@Name //@allCompilationUnits.9/@Package/@Name/@Name //@allCompilationUnits.10/@Package/@Name //@allCompilationUnits.10/@Package/@Name/@Name //@allCompilationUnits.15/@Package/@Name //@allCompilationUnits.15/@Package/@Name/@Name //@allCompilationUnits.16/@Imports.14/@Name/@Qualifier //@allCompilationUnits.16/@Imports.14/@Name/@Qualifier/@Name //@allCompilationUnits.18/@Package/@Name //@allCompilationUnits.18/@Package/@Name/@Name //@allCompilationUnits.21/@Package/@Name //@allCompilationUnits.21/@Package/@Name/@Name //@allCompilationUnits.22/@Package/@Name //@allCompilationUnits.22/@Package/@Name/@Name //@allCompilationUnits.23/@Package/
@AljoschaMeyer
AljoschaMeyer / Bar.java
Created August 11, 2016 12:46
Different representations of two simple Java classes, one of which extends the other. Classes are represented as source code, as ASTs, as ASGs without unification and as ASGs with unification.
package foo;
public class Bar extends Foo {
}
@AljoschaMeyer
AljoschaMeyer / release.json
Last active April 10, 2017 16:23
ssbpm tmp0 release message
{
"type": "ssbpm/tmp0/release",
"package": "&aPackageHash=.abc123",
"change": "minor",
"dependencies": [
{
"link": "&aReleaseHash=.ybc123",
"fixed": false
}
],
@AljoschaMeyer
AljoschaMeyer / data.json
Last active June 5, 2017 18:21
Generate minimal test data for secret-handshake
{"app":{"type":"Buffer","data":[52,185,47,13,238,73,54,193,180,19,66,202,191,136,67,66,207,130,141,57,155,24,157,10,109,135,81,181,218,83,45,48]},"client_pub":{"type":"Buffer","data":[205,114,202,57,38,184,63,222,144,155,64,179,144,197,229,104,203,61,147,95,133,75,69,81,114,149,95,100,152,202,196,229]},"client_sec":{"type":"Buffer","data":[113,68,145,235,255,76,78,208,78,118,201,180,137,97,236,25,175,200,166,106,242,242,232,76,25,143,73,127,1,32,29,173,205,114,202,57,38,184,63,222,144,155,64,179,144,197,229,104,203,61,147,95,133,75,69,81,114,149,95,100,152,202,196,229]},"client_eph_pub":{"type":"Buffer","data":[5,183,99,118,32,105,120,85,99,217,136,206,182,220,187,54,53,38,182,52,146,127,126,36,34,252,151,147,154,206,118,63]},"client_eph_sec":{"type":"Buffer","data":[64,228,231,100,36,145,174,8,56,182,83,77,150,44,120,250,125,72,251,41,5,24,16,209,57,53,192,149,157,160,83,64]},"server_pub":{"type":"Buffer","data":[102,24,108,176,85,212,227,58,158,129,206,237,133,175,164,37,166,135,224,46,113,177,173,46,53,39,
@AljoschaMeyer
AljoschaMeyer / index.js
Created June 9, 2017 14:26
Generate minimal test data for box-stream
const sodium = require('chloride');
const boxes = require('pull-box-stream');
const pull = require('pull-stream');
const encryptionKey = Buffer.from([162,29,153,150,123,225,10,173,175,201,160,34,190,179,158,14,176,105,232,238,97,66,133,194,250,148,199,7,34,157,174,24, 44,140,79,227,23,153,202,203,81,40,114,59,56,167,63,166,201,9,50,152,0,255,226,147]);
const plain1 = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7]);
const plain2 = Buffer.from([7, 6, 5, 4, 3, 2, 1, 0]);
@AljoschaMeyer
AljoschaMeyer / dialogue.md
Last active September 17, 2017 12:51
Draft of a multiplexing abstraction.

Dialogue

A simple abstraction layer for multiplexed, streaming communication between two peers. Inpired by/based on packet-stream, but with a few breaking changes.

Over a reliable, ordered, one-to-one, duplex communication channel, the following types of communication are supported:

  • message: Send a packet to the peer.
  • request: Send a packet to the peer, receive a response packet. Can be cancelled by either participant.
  • duplex: Send many packets to the peer, receive many response packets. Both participants can cancel the duplex.

Additionally, implementations may provide restricted versions of duplexes, e.g. unidirectional streams, or unidirectional streams which expect a single response after signalling their end. On the wire, these would simply use duplex packets, only the interface for the programmer is restricted.

@AljoschaMeyer
AljoschaMeyer / crypto-client.js
Last active October 31, 2017 19:08
js implementation of secret-handshake, with a focus on readability
const {
crypto_auth_verify,
crypto_auth,
crypto_scalarmult,
crypto_hash_sha256,
crypto_sign_ed25519_sk_to_curve25519,
crypto_sign_ed25519_pk_to_curve25519,
crypto_secretbox_open_easy,
crypto_sign_verify_detached,
crypto_sign_detached,
digraph OverallApproach {
/* rankdir=LR; */
node [shape=box];
ssbclient[label="ssb-client"];
ms[label="multiserver"];
muxrpc[label="muxrpc"];
ssbconf[label="ssb-config"];