Skip to content

Instantly share code, notes, and snippets.

View jorpic's full-sized avatar

Max Taldykin jorpic

  • Formal Methods
  • In transit
View GitHub Profile
@jorpic
jorpic / cert.sh
Created January 13, 2017 15:27
TLS certificate generation scripts
#!/usr/bin/env bash
# based on https://jamielinux.com/docs/openssl-certificate-authority/index.html
# TODO: check if root
set -e
ROOT_STORE=/etc/ssl/caroperator-svc/root
ROOT_KEY=$ROOT_STORE/private/ca.key
ROOT_CERT=$ROOT_STORE/certs/ca.cert
const fs = require('fs');
const path = require('path');
const solc = require('solc');
const Web3 = require('web3');
const web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
function compile(src) {
@jorpic
jorpic / index.html
Created July 29, 2016 11:23
Что умеют смартконтракты?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
<style>
@page {
size: landscape;
}
@jorpic
jorpic / index.html
Last active June 28, 2016 14:43
Что случилось с The DAO
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
<style>
@page {
size: landscape;
}
@jorpic
jorpic / index.html
Created June 7, 2016 13:57
Crypto currencies & Smart contracts
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
<style>
@page {
size: landscape;
}
@jorpic
jorpic / ES2015.md
Last active May 20, 2016 14:58
What's new in ES{5,6}
  • Block scopes with let and const
    • let in for loop rebinds variable on each iteration
  • lexical this (instead of dynamic one) with arrow functions
  • method definitions ?
  • shorthand object properties
    • var = {foo, bar}
  • computed property names
    • { [name()]: value }
  • getter & setter methods
@jorpic
jorpic / README.md
Last active February 21, 2016 20:53
Longest streak events

Here is a query adopted from blog.jooq.org:

explain analyze with
  dates(d) as
    (select distinct date(ctime)
      from "Event"
      where modelname='Partner'
        and type = 'Update'
        and userid = 193
@jorpic
jorpic / README.md
Last active February 22, 2016 11:33
97 Things Every Programmer Should Know

TODO: split by topic (code quality, process quality), order by stars

  1. ★★★ Act with prudence

  • technical debt is like a loan: the longer you have it, the worse it gets
  • Martin Fowler distinguishes
    • deliberate technical debt
    • inadvertent technical debt
  • add a ticket and ensure it does not get forgotten
@jorpic
jorpic / active_contracts.sql
Last active February 5, 2016 19:42
Query that will benefit from grouping sets
with
events as
(select
modelid as ctr,
ctime,
(patch->>'isActive')::bool as isActive
from "Event"
where modelname = 'Contract'
and type = 'Update'
and (patch->>'isActive')::bool is not null
@jorpic
jorpic / README.md
Created January 22, 2016 21:26
M202: MongoDB Advanced Deployment and Operations