Skip to content

Instantly share code, notes, and snippets.

:octocat:
_

Paul Miller paulmillr

:octocat:
_
View GitHub Profile
@paulmillr
paulmillr / expo.ts
Created Apr 9, 2020
Fast exponent 2_252_minus_3
View expo.ts
function pow_2_252_3_fast(t: bigint) {
const t0 = mod(t * t);
const t1 = mod(t0 ** 4n);
const t2 = mod(t * t1);
const t3 = mod(t0 * t2);
const t5 = mod(t2 * t3 * t3);
let t7 = t5;
for (let i = 0; i < 5; i++) {
t7 *= t7;
t7 %= P;
@paulmillr
paulmillr / BLS_Signature.md
Created Mar 31, 2020 — forked from hermanjunge/BLS_Signature.md
BLS Signature for Busy People
View BLS_Signature.md

BLS Signature for Busy People

Summary

  • BLS stands for

    • Barreto-Lynn-Scott: BLS12, a Pairing Friendly Elliptic Curve.
    • Boneh-Lynn-Shacham: A Signature Scheme.
  • Signature Aggregation

    • It is possible to verify n aggregate signatures on the same message with just 2 pairings instead of n+1.
View parallel_grep.rs
use std::env::args;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use std::thread;
// grep 6 times faster than unix `grep` CLI
fn read_print(filename: String, matcher: String) {
let path = Path::new(&filename);
View age-spec.md

A simple file encryption tool & format

Filippo Valsorda (@FiloSottile) — Ben Cartwright-Cox (@Benjojo12)

Designed at the Recurse Center during NGW 2019

This is a design for a simple file encryption CLI tool, Go library, and format. It’s meant to replace the use of gpg for encrypting files, backups, streams, etc. It’s called "age", which might be an acronym for Actually Good Encryption, and it’s pronounced like the Japanese 上げ (with a hard g).

@paulmillr
paulmillr / great_code.hs
Created May 4, 2012
Cool & pretty readable haskell code
View great_code.hs
data Cargo = Peasant
| Cabbage
| Wolf
| Goat
deriving (Eq, Enum, Show)
type ShoreState = [Cargo]
type Move = [Cargo]
type State = (ShoreState, ShoreState)
@paulmillr
paulmillr / less.less
Created Mar 9, 2012
Sass vs Stylus vs LESS
View less.less
.border-radius (@radius) {
-webkit-border-radius: @radius;
-o-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
border-radius: @radius;
}
.user-list {
// need to use special `.` syntax
@paulmillr
paulmillr / type-inference.coffee
Created Jul 17, 2012
Damas-Hindley-Milner type inference algorithm in LiveScript
View type-inference.coffee
# Algorithm W (Damas-Hindley-Milner) in LiveScript.
# By Paul Miller (paulmillr.com), Public domain.
#
# Based on Robert Smallshire's [Python code](http://bit.ly/bbVmmX).
# Which is based on Andrew's [Scala code](http://bit.ly/aztXwD).
# Which is based on Nikita Borisov's [Perl code](http://bit.ly/myq3uA).
# Which is based on Luca Cardelli's [Modula-2 code](http://bit.ly/Hjpvb).
# Something like that.
prelude = require './prelude'
@paulmillr
paulmillr / dropkick.sh
Created Dec 22, 2015
Turn off spy cams in airbnb rentals
View dropkick.sh
#!/bin/bash
#
# DROPKICK.SH
#
# Detect and Disconnect the DropCam and Withings devices some people are using to
# spy on guests in their home, especially in AirBnB rentals. Based on Glasshole.sh:
#
# http://julianoliver.com/output/log_2014-05-30_20-52
#
# This script was named by Adam Harvey (http://ahprojects.com), who also
View keybase.md

Keybase proof

I hereby claim:

  • I am paulmillr on github.
  • I am paulmillr (https://keybase.io/paulmillr) on keybase.
  • I have a public key whose fingerprint is E0B4 E9E1 A4B9 C96F 889E 6C6F 6128 0CD9 A383 C2E5

To claim this, I am signing this object:

@paulmillr
paulmillr / unicode_transformer.py
Created Sep 24, 2011
A plugin for Sublime Text 2 that replaces some symbols with their unicode equivalents.
View unicode_transformer.py
# encoding: utf-8
import sublime
import sublime_plugin
class UnicodeTransformer(sublime_plugin.EventListener):
"""The transfrormer was tested with CoffeeScript code."""
_just_io = False # Determines if the file was just loaded / saved.
_is_saving = False
You can’t perform that action at this time.