Skip to content

Instantly share code, notes, and snippets.

View GiorgioRegni's full-sized avatar

Giorgio Regni GiorgioRegni

View GitHub Profile
<!--calculator start-->
<style>
.noUi-tooltip,
.noUi-value {
text-align: center;
white-space: nowrap
}
.noUi-target,
.noUi-target * {
0x5bad81a09ab30fd11146f59c41441c8c7ffd7bd4
@GiorgioRegni
GiorgioRegni / web3.js
Created August 17, 2017 19:03
compiled web3 contract
var browser_untitled_sol_zenko_42_hackathon_ballotContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"getSecond","outputs":[{"name":"_winner","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"getThird","outputs":[{"name":"_winner","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"name","type":"string"},{"name":"voter","type":"address"}],"name":"registerVoter","outputs":[{"name":"_reply","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"teamName","type":"string"}],"name":"voteForTeam","outputs":[{"name":"_msg","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"getWinner","outputs":[{"name":"_winner","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"n","type":"string"},{"name":"a","type":"address"}],"name":"registerTeam","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"
@GiorgioRegni
GiorgioRegni / Zenko_42_Hackathon_Ballot.sol
Last active August 18, 2017 18:49
Zenko_42_Hackathon_Ballot smart contract
pragma solidity ^0.4.15;
contract Zenko_42_Hackathon_Ballot {
uint8 constant VOTES_PER_VOTER = 3;
bool ballotClosed;
struct Team {
uint id;
int votes;
@GiorgioRegni
GiorgioRegni / policy.md
Last active February 11, 2017 21:32
Privacy Policy

This Application does not collect sensitive user information like email, name or phone number.

The application asks for phone state permission only because it is required to be able to PAUSE the app when receiving a phone call and resume when the phone call is over.

Again no sensitive user information is collected, transfered or shared in any way.

For more information please contact [email protected]

Best,

#!/usr/bin/python
import sys
import leveldb
import json
import collections
if len(sys.argv) != 3:
    print 'usage: script db bseq'
    sys.exit(1)
db = leveldb.LevelDB(sys.argv[1])
idx =int( sys.argv[2])-1
let foo=0;
encode(json) {
foo++;
const string = JSON.stringify(json);
const len = Buffer.byteLength(string);
const buf = Buffer.allocUnsafe(4 + len);
buf.writeInt32BE(len);
#!/bin/bash
while true; do
WAIT="$(( $RANDOM % 10 + 1 ))"
echo "Waiting $WAIT seconds"
sleep $WAIT
echo "Killing metadata nodes"
docker exec -it scality-metadata bash -c "pkill node"
docker exec -it scality-metadata bash -c "pkill RepdServerMap"
@GiorgioRegni
GiorgioRegni / agressor.sh
Created November 17, 2015 18:55
Test script for our network investigation
#!/bin/sh
VICTIM="$1"
echo "Starting network tests to $VICTIM"
for CONNECTIONS in 1 10 100 1000 10000 ; do
echo $CONNECTIONS connections
iperf -P $CONNECTIONS -c $VICTIM
done
-module(utils).
-export([comball/1]).
-export([comball/2]).
-export([combuniq/1]).
%% Return all combinations of R elements in list L
comb([], _) -> [[]];
comb(_, 0) -> [[]];
comb(L, R) -> [[H|T] || H <- L, T <- comb(L -- [H], R-1)].