Skip to content

Instantly share code, notes, and snippets.

View xoriole's full-sized avatar

S. Pan xoriole

  • Delft, The Netherlands
View GitHub Profile
@xoriole
xoriole / Sign.java
Created June 13, 2017 07:22
Web3j Sign.java modified to avoid double hashing when signing to make it compatible with geth version result
package org.web3j.crypto;
import java.math.BigInteger;
import java.security.SignatureException;
import java.util.Arrays;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.asn1.x9.X9IntegerConverter;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.ec.CustomNamedCurves;
@xoriole
xoriole / MyFirstToken.sol
Created April 30, 2018 00:28
Token example 1 - First Token
pragma solidity ^0.4.12;
contract MyFirstToken {
string public name = "MyFirstToken";
string public symbol = "MFT";
uint8 public decimals = 2;
uint256 public totalSupply;
// This creates an array with all balances
@xoriole
xoriole / AlumniCredits.sol
Last active April 30, 2018 01:14
Token example 2 - Alumni Credits
pragma solidity ^0.4.12;
contract AlumniCredits {
string public name = "EIT Digital Alumni Credits";
string public symbol = "EITDAC";
uint8 public decimals = 2;
uint256 public totalSupply;
// Foundation address
@xoriole
xoriole / Dockerfile
Last active May 29, 2019 15:40
IPv8 android service dockerfile
FROM triblertester/ipv8-p4a:latest
WORKDIR /home/user
#RUN rm -rf /home/user/.local/lib/python2.7/site-packages/pythonforandroid
RUN mkdir -p /home/user/.local/lib/python2.7/site-packages
RUN if test -L /home/user/.local/lib/python2.7/site-packages/pythonforandroid; then ln -s /home/user/pythonforadnroid /home/user/.local/lib/python2.7/site-packages/pythonforandroid; fi
RUN rm -rf /home/user/ipv8-android-service && git clone https://github.com/Tribler/ipv8-android-service.git && cp -r ipv8-android-service/recipes/* ~/pythonforandroid/recipes
@xoriole
xoriole / Delegation.sol
Created May 30, 2019 16:29
Example contracts showing delegate call
pragma solidity ^0.5.1;
contract Application {
uint public n;
address public sender;
function setN(uint _n) public {
n = _n;
sender = msg.sender;
}
@xoriole
xoriole / version.py
Created June 20, 2019 10:39
Generates Tribler community version file
import base64
import json
from binascii import unhexlify
import requests
from ipv8.keyvault.crypto import default_eccrypto
def get_version():
events_url = "http://localhost:8085/events"
FROM triblertester/ipv8-p4a:latest
VOLUME /dist
WORKDIR /home/user
#RUN rm -rf /home/user/.local/lib/python2.7/site-packages/pythonforandroid
RUN mkdir -p /home/user/.local/lib/python2.7/site-packages
RUN if test -L /home/user/.local/lib/python2.7/site-packages/pythonforandroid; then ln -s /home/user/pythonforadnroid /home/user/.local/lib/python2.7/site-packages/pythonforandroid; fi
RUN rm -rf /home/user/ipv8-android-service && git clone -b jenkins_wild https://github.com/Tribler/ipv8-android-service.git && cp -r ipv8-android-service/recipes/* ~/pythonforandroid/recipes
import ast
import os
import sys
location = os.path.abspath(sys.argv[1])
exclude_from_check = ['twisted/plugins/tunnel_helper_plugin.py']
for (dirpath, dirnames, filenames) in os.walk(location):
for filename in filenames:
@xoriole
xoriole / stable.Dockerfile
Created January 14, 2020 10:40
Snapcraft docker - Core18
FROM ubuntu:bionic as builder
# Grab dependencies
RUN apt-get update
RUN apt-get dist-upgrade --yes
RUN apt-get install --yes \
curl \
jq \
squashfs-tools
@xoriole
xoriole / snapcraft.yaml
Created January 14, 2020 11:07
Tribler snapcraft.yaml [7.5.0+]
name: tribler-bittorrent
version: 7.4.0
summary: Tribler
description: >
Peer-to-peer Bittorrent client with enhanced privacy. Search and download torrents with less worries or censorship.
grade: devel
confinement: devmode
base: core18