Skip to content

Instantly share code, notes, and snippets.

@adzialocha
adzialocha / index.md
Last active February 11, 2022 13:46
How to work with CBOR and CDDL
const CirclesCore = require("@circles/core");
const TokenContract = require("circles-contracts/build/contracts/Token.json");
const Web3 = require("web3");
const privateKey = '';
const provider = new Web3.providers.HttpProvider("http://localhost:8545");
const web3 = new Web3(provider);
const core = new CirclesCore(web3, {
hubAddress: "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
const CirclesCore = require("@circles/core");
const TokenContract = require("circles-contracts/build/contracts/Token.json");
const Web3 = require("web3");
const LOOP_INTERVAL = 1000;
const MAX_ATTEMPTS = 60;
const SAFE_DEPLOYMENT_GAS = Web3.utils.toWei('0.01', 'ether');
const privateKeys = [
"0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",

Trust graph test cases

While waiting for better automated tests of the worker that syncs the trust graph, this is a formally specified test routine that can be run manually with the help of the script in link

Requirements

  • The graph
  • Deployed subgraph with the correct name
  • Ganache-cli
  • Deployed circles contracts
@adzialocha
adzialocha / circles-request-ubi.js
Last active February 3, 2021 14:19
Request UBI for all known Circles Tokens
const CirclesCore = require("@circles/core");
const TokenContract = require("circles-contracts/build/contracts/Token.json");
const Web3 = require("web3");
const chalk = require("chalk");
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
// ===========================
// Configuration
// ===========================

Keybase proof

I hereby claim:

  • I am adzialocha on github.
  • I am adzialocha (https://keybase.io/adzialocha) on keybase.
  • I have a public key ASD9z8Yqg_9qGeVeMRB1HcvKiF6N66YGL34yBcocKRqqdgo

To claim this, I am signing this object:

@adzialocha
adzialocha / hyg-database-converter.py
Last active April 2, 2018 10:41
Convert HYG Database of stars into json file
import argparse
import csv
import json
import os
import urllib
def is_float(x):
try:
a = float(x)
except ValueError:
@adzialocha
adzialocha / websocketUDPBridge.py
Created May 14, 2014 14:36
Websocket-UDP Bridge with HTTP Server
import time, sys, os, pkg_resources
import SocketServer
from twisted.python import log
from twisted.internet import reactor
from twisted.application import service
from twisted.internet.protocol import DatagramProtocol, Protocol, Factory
from twisted.web.server import Site
@adzialocha
adzialocha / keyboardListener.coffee
Last active December 31, 2015 03:29
Simple Listener directive for firing on keyboard state change ('onKeyboardShow', 'onKeyboardHide') in cordova angular apps (with fixed orientation)
'use strict'
angular.module('app')
.directive 'keyboardListener', [ '$rootScope', ($rootScope) ->
restrict: 'A'
link: ($scope, $element, attrs) ->
_height = undefined
@adzialocha
adzialocha / gist:5912224
Created July 2, 2013 19:17
simple text truncation directive (using truncate="text" in dom) - sketch for angular
'use strict'
angular.module('angular-truncate')
.directive 'truncate', [ () ->
restrict: 'A'
link: (scope, element, attrs) ->
# wait until text is available