Skip to content

Instantly share code, notes, and snippets.

View apogiatzis's full-sized avatar
:electron:
Stay awhile and listen.

APogiatzis apogiatzis

:electron:
Stay awhile and listen.
View GitHub Profile
@apogiatzis
apogiatzis / Dice.sol
Last active April 7, 2024 01:02
Dice rolling game smart contract skeleton
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/IERC20.sol";
contract Dice {
IERC20 public nativeGameToken;
mapping(address => UserBet) private userBets;
struct UserBet {
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/994b23af916ae7ee30665f1e4595739c/raw/20d3f719a734beddb08d3e38c24dac212884e55c/lab3_ex_persons.csv" AS csvLine
MERGE (e:Email {address: csvLine.email})
MERGE (t:Phone {number: csvLine.phone})
CREATE (p:Person {obj_id: csvLine.obj_id, first_name: csvLine.first_name, last_name: csvLine.last_name, date_of_birth: date(csvLine.date_of_birth), occupation: csvLine.occupation, nationality: csvLine.nationality, phone: csvLine.phone, ni_number: csvLine.ni_number})
CREATE (p)-[:HAS_EMAIL]->(e)
CREATE (p)-[:HAS_PHONE]->(t);
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/726e0ed7416b530e40d81bc02ef32543/raw/678931d860273c8b903fa8005dfda1cf7cce7ede/lab3_ex_trusts.csv" AS csvLine
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/f72aa0874175c489295439e6e2fd0343/raw/aff7f22d81821820073298d69303422c94ecffd8/lab3_persons.csv" AS csvLine
MERGE (e:Email {address: csvLine.email})
MERGE (t:Phone {number: csvLine.phone})
CREATE (p:Person {obj_id: csvLine.obj_id, first_name: csvLine.first_name, last_name: csvLine.last_name, date_of_birth: date(csvLine.date_of_birth), occupation: csvLine.occupation, nationality: csvLine.nationality, phone: csvLine.phone, ni_number: csvLine.ni_number})
CREATE (p)-[:HAS_EMAIL]->(e)
CREATE (p)-[:HAS_PHONE]->(t);
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/ec64d09f7d8f626aaafd848e603cadba/raw/6127d7c4d327c05145678ab18c6f580a69b96749/lab3_trusts.csv" AS csvLine
@apogiatzis
apogiatzis / common_modulus.py
Created November 13, 2018 04:25
RSA Common modulus attack
import argparse
from fractions import gcd
parser = argparse.ArgumentParser(description='RSA Common modulus attack')
required_named = parser.add_argument_group('required named arguments')
required_named.add_argument('-n', '--modulus', help='Common modulus', type=long, required=True)
required_named.add_argument('-e1', '--e1', help='First exponent', type=long, required=True)
required_named.add_argument('-e2', '--e2', help='Second exponent', type=long, required=True)
required_named.add_argument('-ct1', '--ct1', help='First ciphertext', type=long, required=True)
@apogiatzis
apogiatzis / NFT.sol
Created November 24, 2022 01:22
ERC721 Contract for Comp1830
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Comp1830NFT is ERC721Enumerable, Ownable {
using Strings for uint256;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract Ballot {
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 4 columns, instead of 3. in line 7.
obj_id,beneficiary,trustor,trustee
b853671b-f275-4865-ba87-4169ff68880d,580fc4ad-8b88-4f4b-9ef1-19ea974eafa3,744b9918-e57b-4c1b-9eed-44ef2318576c,64c496fa-07c1-4880-96f3-1513b14c90f7
5bf01e7b-7741-4906-9548-e2a90607f4c5,8fbe937d-4c5b-4db6-b758-85c955b3f9e1,7d7a8a83-c411-45e7-b814-3a37c8f0a97a,5dffd331-5897-4ad9-bef7-c2c26dbac91a
d5084e8a-9ea8-4607-982c-60954b4cb20d,b105432e-9b15-4321-87d6-64b3bc2d95d9,5a905799-1549-44ce-9870-f3abf87b1360,ca675d70-db39-4afb-a0d8-0d3fc75516ba
77f6be93-5b1c-4d10-8aa6-3a0ea05d0c63,fb1bbdf0-488b-4029-933e-8968a269ec1b,8d5852c9-1380-4bdf-840a-59bb3bf2dba6,2d64a3c6-7992-4057-8159-eb3dda0b54f6
087540b2-f249-479d-b847-7f64cfb54cb5,415f6874-e7ed-4702-92ae-fe1b0814c816,882d6977-8457-4375-84f2-7e7a81c24db9,0389157b-9bf5-44fa-aaac-c9c0e70e194c
bd641739-8a51-4f3b-b9aa-eb22c107f292,89f13862-c714-4679-bced-72a6d0d7c93c,651992d3-dc6d-4cd1-908a-70eb3e639251,39c5ac27-0688-4b5b-a703-c34e342eefc3
6240a372-9b9d-49fe-bfa9-41599e5c5081,60bf640c-352b-4efb-8bc2-682c260f8938,7fb73ab5-dbaf-4dea-9846-a51
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 6 columns, instead of 4. in line 9.
obj_id,balance,currency,owners,bank,opened_at
6b05e744-b186-46ce-bed7-d0ab3443b9e2,50956.0,GBP,b853671b-f275-4865-ba87-4169ff68880d,RCB,2014-03-06 02:56:36
38f2a17e-88a9-45ee-acab-8dbfd125241e,0.0,GBP,5bf01e7b-7741-4906-9548-e2a90607f4c5,Credit Suisse AG,2017-11-11 16:00:52
0f0888d9-1cdf-435d-bc74-6c1a7eb05153,0.0,GBP,d5084e8a-9ea8-4607-982c-60954b4cb20d,RCB,2020-07-15 07:19:30
5581edbb-3489-4f4b-b1d5-abb539296cf5,0.0,GBP,77f6be93-5b1c-4d10-8aa6-3a0ea05d0c63,Credit Suisse AG,2015-05-20 05:48:45
4d1d4ff5-9aa5-433c-9755-fb19bf907cd4,0.0,GBP,087540b2-f249-479d-b847-7f64cfb54cb5,RCB,2011-08-02 20:07:09
c39a04f1-a581-4ee2-ada5-bc3967c1e227,0.0,GBP,bd641739-8a51-4f3b-b9aa-eb22c107f292,Credit Suisse AG,2020-03-29 09:01:14
11e2c8ce-eabc-4aa0-84d2-e25257632980,0.0,GBP,6240a372-9b9d-49fe-bfa9-41599e5c5081,CitiBank,2015-05-22 03:46:43
23b4f2a6-31b8-4fbb-8d45-5685a2433d26,0.0,GBP,d1615bfc-014d-4eed-a0fa-4da97d0ee72b,Credit Suisse AG,2018-09-26 14:03:31
7a885967-4f42-4a03-93d2-6f6660f610ff,0.0,GBP,79e77c1a-0bd6-4914-8ac7-
obj_id amount currency sender recipient type timestamp
46cc67d3-7522-4d3b-86aa-fb61074916a8 4402.847864533552 GBP 41aeba1d-729e-4d6d-9d3b-96e70ad3baa5 d0153de6-a181-4a46-8896-cb7d39390fb6 TRANSFER 2022-02-06 15:43:16
db2292e6-504e-4494-b85c-e2361190d77a 4774.258055865538 GBP c031d259-694a-49df-a0ef-a523a04e1a33 da6df937-c734-4b81-bb55-cb074c27368d TRANSFER 2021-04-04 01:13:27
a4041f65-6df2-4cc7-a618-63d86b372ed1 1802.982096175261 GBP f29ac848-8c14-4d3f-a4ec-617e8e4d42a0 4df2d8e9-168c-4076-9969-a1539af41b05 TRANSFER 2016-11-06 15:56:12
67a0c123-dcd4-464f-8568-48614252f838 14374.735437136478 GBP ecda79b8-314b-4cca-924e-2f1e8bd1b749 376e92c8-9852-4a4f-ad52-0b7b4a558bc0 TRANSFER 2021-11-27 04:23:16
ebc2b465-4cb7-4410-af40-360498422935 1962.6293489675907 GBP a28fc8c0-3b89-495a-a993-c8fdfe2649cc 68902c04-4bce-4d4e-ba59-885ce4f489a6 TRANSFER 2021-01-09 06:11:35
241dec60-81d8-4a26-98b9-6c3e7d27af61 888.7481645593303 GBP f457c639-f9cb-4541-bf2f-3b4e3f5ace14 32554a24-12aa-437f-a080-d78a719d1333 TRANSFER 2009-06-04 07:2