Skip to content

Instantly share code, notes, and snippets.

@crokkon
crokkon / prime.py
Last active October 22, 2019 17:53
primes
# is_prime() is based on https://hackernoon.com/prime-numbers-using-python-824ff4b3ea19
def is_prime(number):
if number <= 1:
return False
prime = True
for num in range(2, int(number ** 0.5) + 1):
if number % num == 0:
prime = False
break
return prime
@crokkon
crokkon / get_transaction.py
Last active January 4, 2019 20:42
set_authorities.py
from beem import Steem
from beem.account import Account
from beem.amount import Amount
from argparse import ArgumentParser
from beembase import operations
from beem.transactionbuilder import TransactionBuilder
import json
parser = ArgumentParser()
parser.add_argument('--account', type=str, required=True)
@crokkon
crokkon / analyze_accounts.py
Created November 10, 2018 21:27
visualize the voting behavior of a set of accounts
#!/usr/bin/python
import sys
from beem.account import Account
from beem.utils import addTzInfo, parse_time
from datetime import datetime, timedelta
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
#!/usr/bin/python
from beem import Steem
from beem.amount import Amount
from beem.account import Account
from getpass import unix_getpass
from beem.transactionbuilder import TransactionBuilder
from beembase import operations
from beemgraphenebase.account import PasswordKey
from argparse import ArgumentParser
import json
#!/usr/bin/python
from steemdata import SteemData
import sys
import datetime as dt
import shelve
from steem.amount import Amount
from steem.utils import parse_time
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from beem import Steem
import json
import re
import os
import cfg_crokkon as cfg
blogpost = "1806_beemdev.md"
beneficiaries = [{'account':'utopian-io', 'weight':1000}]
tags = ['utopian-io', 'development', 'beem', 'python', 'steemdev']
title = "Beem: beneficiaries support, get account creator + " \
@crokkon
crokkon / reward_pool_simulation.py
Last active April 23, 2018 06:25
Reward Pool Simulation
#!/usr/bin/python
import matplotlib.pyplot as plt
"""
Simplified simulation:
* 1 "day" block time
* 7 "days" payout time
* static inflation
"""