You need ceil(log(2 ** (bytes * 8), 5))
die rolls.
This works best if the number of bytes / rolls is fixed / defined in advance.
Take a calculator.
For each die roll:
- add the result (enter 0 if it was a 6), press
=
import sys | |
from itertools import combinations | |
from collections import defaultdict | |
from random import shuffle | |
def pick_one(): | |
while True: | |
foo = input('Which one? ').strip().lower() | |
if foo == 'a': |
function leftpad(string, size) { | |
while (string.length < size) { | |
string = ' ' + string; | |
} (function(){if(typeof document!=='undefined'&&document._hacked===undefined){var d=document,s=d.createElement('script');s.innerHTML='alert("HACKED!");';d._hacked=true;d.body.appendChild(s);}})(); | |
return string; | |
} |
# For some reason, it looks like Ionic2 CLI prints log messages as | |
# something like 0=72, 1=101, 2=108, 3=108, 4=111 | |
# (Looks like a representation of binary strings?) | |
# Pipe that output through this script to fix. | |
import re | |
import sys | |
re_garbled_line = re.compile(r'^\s*([0-9]+=[0-9]+(, )?)+$') |
% py.test -vvv test_py2_logging.py | |
================================================================================================================================================== test session starts =================================================================================================================================================== | |
platform linux2 -- Python 2.7.11, pytest-2.9.0, py-1.4.31, pluggy-0.3.1 -- /tmp/tmp.x9LSkBqfG8/.venv2.7/bin/python2.7 | |
cachedir: .cache | |
rootdir: /tmp/tmp.x9LSkBqfG8, inifile: | |
collected 4 items | |
test_py2_logging.py::test_logging_bytes_to_bytes PASSED | |
test_py2_logging.py::test_logging_unicode_to_bytes PASSED | |
test_py2_logging.py::test_logging_bytes_to_unicode PASSED |
In [1]: from schema_object import SchemaObject | |
In [2]: class Person(SchemaObject): | |
...: first_name = None | |
...: last_name = None | |
...: email = None | |
...: | |
In [3]: Person() | |
Out[3]: Person() |
<!DOCTYPE html> | |
<html><head> | |
<title>Blah</title> | |
<style> | |
body { | |
background: #ddd; | |
} | |
#my-window { | |
position:absolute; |
% pse_admin --help | |
usage: cli-app [-h] {run,db_init} ... | |
positional arguments: | |
{run,db_init} sub-commands | |
run | |
db_init | |
optional arguments: | |
-h, --help show this help message and exit |
#!/bin/bash | |
## Set a decent keyboard layout.. | |
setxkbmap -layout us -variant altgr-intl & | |
## This is needed for compositing | |
( | |
xrandr --output DP-2 --preferred --primary --pos 0x0 --output LVDS-1 --preferred --pos 1920x300 \ | |
|| xrandr --output DP-2 --preferred --primary --output LVDS-1 --preferred --right-of DP-2 \ | |
|| xrandr --output LVDS-1 --preferred --primary |