Skip to content

Instantly share code, notes, and snippets.

View kristovatlas's full-sized avatar

Kristov Atlas kristovatlas

View GitHub Profile
@kristovatlas
kristovatlas / randsim.py
Last active December 27, 2017 22:40
simulating the broadcasting of Bitcoin transactions and first-hop reception by sybil attacker
import itertools
from random import randint
#p = 0.95
OTHER_NODES = 10000
MY_NODES = 4410
MY_CONNECTIONS = 8 * MY_NODES #my nodes are malicious and make 8 connections per peer
ALL_NODES = OTHER_NODES + MY_CONNECTIONS
NUM_BROADCASTED = 2
@kristovatlas
kristovatlas / README.md
Created April 16, 2018 01:22
How to verify Trezor Bridge on MacOS (and maybe other operating systems)

Background reading

Verification Steps

  1. Visit https://wallet.trezor.io/data/bridge/latest/index.html. For MacOS, you download a .pkg file.
  2. From https://wallet.trezor.io/data/bridge/latest/index.html also download the PGP signature file.
  3. The Satoshi Labs CTO signs the Bridge releases. Download his PGP key from his Keybase signature: https://keybase.io/stick This means at least that someone created an account with his identity and bothered to link a specific PGP key. If you retain this key over time, you can be sure that it wasn't recently swapped out. You can find same PGP under his identity in various places on the web: https://duckduckgo.com/?q=Pavol+Rusn%C3%A1k+pgp+key&ia=web
NUM_FIB_NUMS = 100
F1 = 0
F2 = 1
POS = 2
print "0,0"
print "1,1"
for count in range(1, NUM_FIB_NUMS + 1):
@kristovatlas
kristovatlas / emailer.py
Created September 16, 2020 17:08
Send GMail
#python3
# Usage: emailer.send(recipient_email, mail_subject, message)
#https://stackabuse.com/how-to-send-emails-with-gmail-using-python/
import smtplib
gmail_user = '[email protected]'
gmail_password = 'password_goes_here'
sent_from = gmail_user
def send(recipients, subject, body):
@kristovatlas
kristovatlas / evidence.py
Created October 23, 2020 20:10
evidence.py
"""
https://twitter.com/elliot_olds/status/1319364546880942080
To keep calculations simple, let's fix population size to 100
"""
POPULATION = 100
FRED_PROB_FIRST = 1/(0.6 * POPULATION)
NOT_FRED_PROB_FIRST = 1-FRED_PROB_FIRST
def prob_no_blood_type(population, num_crime_scene):