Skip to content

Instantly share code, notes, and snippets.

View gdassori's full-sized avatar
👨‍🏭
Available for proposals.

dax gdassori

👨‍🏭
Available for proposals.
View GitHub Profile
Ho pensato a un sistema per la creazione di randomismo fra due parti che non si fidano di loro, con verifica finale, per giochi 1vs1:
- Due parti, entrambe, partono con un Seed Bip32 in mano, ognuna col suo, depositano i soldi su un contratto contestualmente dichiarandogli una chiave pubblica ad altezza 0, e con questa cominciano a giocare (quindi per cominciare la partita entrambe le parti depositano soldi su un contratto e dichiarano un numero da 32bit).
- A ogni round di gioco derivano la Nesima chiave pubblica, e usano quel numero per chiamare entrambi il contratto e procedere col round.
La risultanza dei due numeri verra' usata come seed per produrre il numero randomico di cui hanno bisogno per quel round (quindi seed per la produzione di randomicita' di quel round, che permette di generare N numeri pseudorandomici, e' la risultanza di un'operazione fra le due Nesime chiavi pubbliche dichiarate).
- Alla fine della partita, per fare cassa, devono svelare la master public key, e il contratto deve veri
@gdassori
gdassori / Prompt
Created April 30, 2023 08:54
GPT music Player
Please generate a JSON song using the following contract:
The song data should be an object with the following properties:
channel1: An array of numbers and strings representing the notes for the first channel.
channel2: An array of numbers and strings representing the notes for the second channel.
channel3: An array of numbers and strings representing the notes for the third channel.
channel4: An array of numbers and strings representing the notes for the fourth channel.
Each channel should have at least one note, and each note should be a positive integer representing the frequency in Hertz or a string that starts with the letter 'r' followed by a duration in milliseconds for pauses. The duration of each note/pause should be 250 milliseconds, except for pause notes, in which the duration should be the specified pause duration.
@gdassori
gdassori / bitcoin_centralizzato.md
Last active May 13, 2022 10:24
Il mining di Bitcoin è centralizzato.

Ci sono poche aziende a controllare tutto il mining di Bitcoin, come si può vedere in questo link?

Quelle di cui si parla in questo link sono le mining pool, semplici servers a cui i miners si collegano per fare il loro lavoro. Le mining pool sono una forza del bene all'interno della teoria dei giochi della blockchain, perché permettono a migliaia di miners in tutto il mondo di coordinarsi e consociarsi nell'hashing.

Se una mining pool "si comporta male", ovvero centralizza troppo potere (potresti voler approfondire il 51% attack), oppure se inizia a segnalare blocchi non validi (potresti voler approfondire SegWit2X), questa viene emarginata (potresti voler approfondire il movimento NO2X), e i miners si spostano su altre mining pool, o nascono nuove mining pool.

I miners sono migliaia in tutto il mondo, sotto griglie energetiche diverse, con hardware di loro proprietà, e sono loro che hanno fatto l'investimento effettivo. Le mining pool non hanno niente

@gdassori
gdassori / CVE-2018-17144.py
Created May 27, 2021 10:46
Exploiting CVE 2018-17144 on Bitcoin Testnet
# Exploiting CVE 2018-17144 on Bitcoin Testnet
# Guido Dassori, twitter.com/khs9ne
# https://bitcoindev.network/looking-back-on-exploiting-cve-2018-17144/
import typing
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
import requests
#!/bin/env python3
import os
import sys
import json
import uuid
import argparse
import logging
import coloredlogs
import requests
@gdassori
gdassori / pubnub_e2e_chat.py
Last active April 5, 2020 22:19
pubnub_e2e_chat
# "I don't trust e2e chats, I don't know what's under the hood on signal, actually"
#
# "Ok, gimme 10 minutes, let me setup a e2e chat script. We'll use a free service on the
# other side of the world, transferring meaningless base64 AES encrypted payloads over the net"
#
# "Ah, cool".
#
# Very buggy - Don't expect fixes
#
# Signup for api keys at https://pubnub.com
@gdassori
gdassori / dump_ncov_reports.sh
Last active February 1, 2020 15:07
Dump 2019-nCoV Coronavirus Raw Reports
#!/bin/bash
DIRECTORY="/home/guido/ncov"
TODAY=date +%Y%m%d
NOW=$TODAY`date +%H%M`
mkdir -p $DIRECTORY/data/CDC/$TODAY
mkdir -p $DIRECTORY/data/DXY/$TODAY
mkdir -p $DIRECTORY/data/ECDC/$TODAY
mkdir -p $DIRECTORY/data/JHU-CSSE/$TODAY
@gdassori
gdassori / entry_point.py
Last active November 23, 2019 08:40
Server Websocket Barbino
from aiohttp import web
from core.src.world.builder import websocket_channels_service
from core.src.world.services.websocket_router import sio, loop, app
from etc import settings
if __name__ == '__main__':
websocket_channels_service \
.set_socketio_instance(sio) \
.set_event_loop(loop)
@gdassori
gdassori / run_together.py
Created July 30, 2019 16:03
python: run_together
def run_together(*tasks) -> Tuple:
from multiprocessing.pool import ThreadPool
pool = ThreadPool(len(tasks) if len(tasks) < 8 else 8)
results = []
for task in tasks:
if len(task) > 3:
raise ValueError('Syntax Error')
if len(task) > 1:
a = task[1] if isinstance(task[1], tuple) else (task[1],)
else:
@gdassori
gdassori / block.py
Created April 9, 2019 12:46
layerthree's block deserializer \ serializer
import binascii
from layerthree import ioc
from layerthree.utils import deserialize_header, header_to_hash, get_merkle_tree
class Block:
TYPE = 1
def __init__(self, blockhash: str):
self.blockhash = blockhash