When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}| ''' listing 6: pi_mp.py | |
| Multiprocessing based code to estimate the value of PI | |
| using monte carlo sampling | |
| Ref: http://math.fullerton.edu/mathews/n2003/montecarlopimod.html | |
| Uses workers: | |
| http://docs.python.org/library/multiprocessing.html#module-multiprocessing.pool | |
| ''' | |
| import random |
| """ | |
| This code computes pi. It's not the first python | |
| pi computation tool that I've written. This program | |
| is a good test of the mpi4py library, which is | |
| essentially a python wrapper to the C MPI library. | |
| To execute this code: | |
| mpiexec -np NUMBER_OF_PROCESSES -f NODES_FILE python mpipypi.py |
| =begin | |
| Find pi by the Monte-Carlo method. | |
| area of a circle = pi r^2 | |
| area of a square = (2r)^2 = 4 r^2 | |
| Perform random uniform sampling between -1 and 1. | |
| The proportion of points in the unit circle is: | |
| p = (pi r^2) / (4r^2) |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| letters-to-100.py | |
| """ | |
| import string | |
| letter_values = dict((l, i) for i, l in enumerate(string.lowercase, start=1)) | |
| english_dict = open('/usr/share/dict/words', 'rU') |
| #!/bin/bash | |
| if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
| appify v3.0.1 for Mac OS X - http://mths.be/appify | |
| Creates the simplest possible Mac app from a shell script. | |
| Appify takes a shell script as its first argument: | |
| `basename "$0"` my-script.sh |