This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from steem import Steem | |
| from steem.account import Account | |
| import pickle | |
| import os | |
| userlist = 'top-users.txt' | |
| #userlist = 'some-users.txt' | |
| outputFile = 'rewards-shares.txt' | |
| with open( userlist, "r" ) as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| from twython import Twython | |
| import json | |
| import pprint | |
| import pandas | |
| from datetime import datetime, timedelta | |
| from email.utils import parsedate_tz | |
| with open( "secret.json", "r" ) as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To compile: g++ -o rsa_with_psuedoprimes rsa_with_psuedoprimes.cpp -lgmpxx -lgmp | |
| #include <iostream> | |
| #include <gmp.h> | |
| gmp_randstate_t random; | |
| void | |
| randomPrime( mpz_t out, int nBits ) { | |
| mpz_init( out ); | |
| do { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c Problem generated from carry-save[n-bit] multiplication circuit | |
| c by Paul Purdom and Amr Sabry | |
| c | |
| c Circuit for product = 91 [True,False,True,True,False,True,True] | |
| c Variables for output [msb,...,lsb]: [116,115,110,105,100,96,68,37,19,11] | |
| c Variables for first input [msb,...,lsb]: [6,5,4,3,2,1] | |
| c Variables for second input [msb,...,lsb]: [10,9,8,7] | |
| c | |
| c | |
| p cnf 116 434 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Factoring to 3-SAT | |
| ## https://www.cs.indiana.edu/cgi-pub/sabry/cnf.html | |
| import math | |
| class ThreeSatInstance(object): | |
| def __init__( self, numVariables ): | |
| self.numVariables = numVariables | |
| self.clauses = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rule110_dict = { | |
| "111" : "0", | |
| "110" : "1", | |
| "101" : "1", | |
| "100" : "0", | |
| "011" : "1", | |
| "010" : "1", | |
| "001" : "1", | |
| "000" : "0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import sys | |
| import networkx as nx | |
| from networkx.algorithms.distance_measures import diameter | |
| from itertools import zip_longest, combinations | |
| class HistogramSet(object): | |
| def __init__( self ): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mpmath | |
| from fractions import Fraction | |
| def earliestDecimalMatch( f, nDigits ): | |
| """Return the earliest fraction in the enumeration | |
| 0/1, 1/1, 1/2, 1/3, 2/3, 1/4, 2/4, 3/4, 1/5, ... | |
| that matches the value of f to nDigits of accuracy.""" | |
| # 3 digits: 0.333 * 1000 = 333 | |
| # Clueless search: try every possible denominator from smallest to largest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ArrayProblem(object): | |
| def __init__( self, array, target ): | |
| self.array = array | |
| self.target = target | |
| # These counters will be exclusive, the | |
| # range being considered is array[left:right] | |
| self.left = 0 | |
| self.right = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import matplotlib.pyplot as plt | |
| # Code adapted from https://en.wikipedia.org/wiki/Hilbert_curve | |
| def rot( n, x, y, rx, ry ): | |
| if ry == 0: | |
| if rx == 1: | |
| x = (n-1) - x | |
| y = (n-1) - y |