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 random | |
def weighted_choice(choices): | |
total = sum(w for c, w in choices) | |
r = random.uniform(0, total) | |
upto = 0 | |
for c, w in choices: | |
if upto + w >= r: | |
break | |
upto += w |
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/env python | |
#coding: utf8 | |
import base64 | |
import hashlib | |
import binascii | |
from Crypto import Random | |
from Crypto.Cipher import AES | |
from os import urandom |
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
#!/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
from hashlib import md5 | |
from operator import itemgetter | |
""" | |
name: secret_share.py | |
description: Algorithm for secure multi-circuit key distribution. |
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
#!/bin/python | |
import base64 | |
import zlib | |
import sys | |
""" | |
name: data_compressor.py | |
description: Lossless data compression code snippet with the help of zlib DEFLATE (Lempel–Ziv 1977) compression algorithm. | |
author: Bryan Angelo Pedrosa | |
""" |
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/python | |
import time | |
from random import random | |
from bisect import bisect | |
def probdist_choice(choices): | |
values, weights = zip(*choices) | |
total = 0 | |
cum_weights = [] |
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/python | |
from __future__ import division | |
""" | |
name: AnSyn_salary_microeconomics.py | |
description: Anarcho-Syndicalism/Anarcho-Collectivist salary distribution system. 100% legit no scam. Accurate calaculation. | |
author: Bryan Angelo Pedrosa | |
min_salary - the standard minimum pay. no matter what happen. | |
peak_salary - highest pay if average income per worker reached peak. |
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
/* | |
* title: The bandcamp pirates. | |
* coded by: Bryan Angelo Pedrosa | |
* date: 19 November 2019 | |
*/ | |
/* to download album (free version) */ | |
window.location=TralbumData["freeDownloadPage"] |
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 json | |
import requests | |
import webbrowser | |
def _input(form): | |
try: | |
return raw_input(form) | |
except: | |
return input(form) |
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
<?php | |
function cropAlign($image, $cropWidth, $cropHeight, $horizontalAlign = 'center', $verticalAlign = 'middle') { | |
$width = imagesx($image); | |
$height = imagesy($image); | |
$horizontalAlignPixels = calculatePixelsForAlign($width, $cropWidth, $horizontalAlign); | |
$verticalAlignPixels = calculatePixelsForAlign($height, $cropHeight, $verticalAlign); | |
return imageCrop($image, [ | |
'x' => $horizontalAlignPixels[0], | |
'y' => $verticalAlignPixels[0], | |
'width' => $horizontalAlignPixels[1], |
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 os | |
from hashlib import sha512 | |
def authBlock(): | |
pass | |
# auth hash before inserting into blockchain | |
def authHashPOW(ref): | |
with open("HashPOWs","a+") as f: | |
for line in f: |