Skip to content

Instantly share code, notes, and snippets.

@iantanwx
iantanwx / # weechat - 2018-10-09_14-26-14.txt
Created October 9, 2018 06:27
weechat on macOS 10.14 - Homebrew build logs
Homebrew build logs for weechat on macOS 10.14
Build date: 2018-10-09 14:26:14
@iantanwx
iantanwx / scilla_types.pegjs
Created July 25, 2018 16:12
PoC: Peg.js grammar for parsing JSON encoded Scilla types
BaseType = base:(Map/Uint/String) _* "(" vtypes: (type:VType _* {return type})* ")" { return { base: base, vtypes: vtypes }}
VType = Uint/String
Map = "Map"
Uint = "Uint"
String = "String"
_ = [ \t\n]
@iantanwx
iantanwx / morevp.md
Created July 17, 2018 02:56
Notes on More Viable Plasma

Notes: More Viable Plasma

More Viable Plasma was proposed by Kelvin Fichter. Essentially, it modifies:

  • the priority queue, to process exits of transactions with the oldest youngest input first. This is very much mind fuckery, but it will be explained in detail below.
  • the exit game, wherein even inputs of non-canonical transactions can be exited. The game is also extended to a 2-phase process.
@iantanwx
iantanwx / minvp.md
Created July 17, 2018 02:55
Notes on Minimal Viable Plasma

Notes: Minimal Viable Plasma

Definitions, Components & Actors

  • Root Chain (RC): refers to a smart contract on the Ethereum (or any other general compute blockchain with a Turing-complete VM).
  • Plasma Chain (PC/Operator): refers to Campfire (in our case). The Plasma Chain is where most of the action happens. Its blocks are compressed and recorded on the RC's smart contract.
  • Validator Nodes (Vals): a set of nodes that have the privilege to propose
@iantanwx
iantanwx / variance.ts
Created July 24, 2017 08:36
Variance Quirks in TypeScript
interface Animal {
play(arg: Toy): Toy;
}
interface Dog extends Animal {
type: 'dog';
}
interface Cat extends Animal {
type: 'cat';
@iantanwx
iantanwx / subset.js
Created June 8, 2016 15:15
Subset Sum Problem
/**
* Since this is a test, I implemented everything in vanilla JS
* There are no depencies, although I would otherwise have looked to use lodash or immutable for this type of algorithm
* That did cause it to take little longer to solve, but it was a good exercise ^^
*/
'use strict';
function sum(array) {
var sum = 0;
@iantanwx
iantanwx / scripts.php
Created June 8, 2016 15:15
PHP + PHP/JS
<?php
function getPrimes($n) {
// throw an exception if $n is not an int or <= 1
if (!is_int($n) || $n <= 1) { throw new Exception("Input must be of type int and > 1", 1); }
$primes = array(2);
// if $n == 2 just return $primes
if ($n == 2) { return $primes; }
# Forwarded GIF_NAME as a query string
RewriteEngine On
RewriteRule ^(midlet|wap|ajax|touch)\/gift\/([0-9]+)_(\w+)\/([0-9]+)\/([0-9]+)? /gift.php?view=$1&gift_id=$2&gif_name=$3&sender_id=$4&receiver_id=$5
SELECT date AS day,
COUNT(CASE WHEN score >= 0.00 THEN 1 ELSE NULL END) AS num_pos_scores,
COUNT(CASE WHEN score < 0.00 THEN 1 ELSE NULL END) AS num_neg_scores
FROM assessments
WHERE is_date >= STR_TO_DATE('2011-03-01', '%Y-%m-%d')
AND is_date <= STR_TO_DATE('2011-04-30', '%Y-%m-%d')
GROUP BY DATE(date);
SELECT date AS day
FROM assessments
#!/bin/bash
# Get count
ps aux | grep [h]ttpd -c
# Rename files
find mig33/inner.folder -name *.txt -exec bash -c 'echo "$0" "${0%.txt}.data"' {} \;