brmlab election/voting tools
  • Scheme 75.4%
  • Perl 13%
  • Shell 4.6%
  • Makefile 3.4%
  • CSS 2.3%
  • Other 1.3%
Find a file
2026-09-28 22:02:39 +00:00
css layout improvements 2026-09-28 21:26:50 +00:00
doc add data model documentation 2026-09-28 17:51:00 +00:00
images static assets 2026-09-22 08:54:45 +00:00
src use stylesheet 2026-09-28 22:02:39 +00:00
.gitignore .gitignore more 2026-09-28 19:31:19 +00:00
18.sql testing data based on 1929 St. Valentine Massacre 2026-09-28 19:38:06 +00:00
AGENTS.md update AGENTS.md 2026-09-25 23:47:36 +00:00
brmelect.sql move status history into separate *_history tables 2026-09-28 19:50:27 +00:00
build-libpq.sh fix build and separate from install 2026-09-26 17:51:32 +00:00
configure add build scripts for chicken-bin and static libpq deps 2026-09-26 13:24:15 +00:00
gen-ballot.pl gen-ballot.pl: Wider ballot papers 2017-12-19 13:53:58 +01:00
hlas-example.txt +hlas-example.txt 2017-12-19 16:36:25 +01:00
hlas.pl +hlas-example.txt 2017-12-19 16:36:25 +01:00
html2at.pl add html2at.pl - helper for converting html to at-expr 2026-09-28 19:30:12 +00:00
install-eggs.sh elect.brmlab.cz specific tweaks 2026-03-16 22:32:27 +00:00
Makefile fix build and separate from install 2026-09-26 17:51:32 +00:00
model-generate-ballot-coord-radom.pl add scripts for ballot behavioral testing 2026-09-28 19:34:49 +00:00
model-generate-ballot-order.pl add scripts for ballot behavioral testing 2026-09-28 19:34:49 +00:00
model-generate-ballot-shuffle.pl add scripts for ballot behavioral testing 2026-09-28 19:34:49 +00:00
model-generate-ballot.pl add scripts for ballot behavioral testing 2026-09-28 19:34:49 +00:00
names-sample.txt Initial version, with gen-ballot.pl 2014-10-08 21:28:38 +02:00
prepare.sh elect.brmlab.cz specific tweaks 2026-03-16 22:32:27 +00:00
README.md README: Drawing Lots 2017-12-19 16:49:35 +01:00
SESSION_NOTES.md route all 200 responses through layout 2026-09-28 21:02:19 +00:00
web-ballot.pl Add support for election labels 2014-10-13 23:52:35 +02:00

Initialization

Decide on label of the election. We will refer to that as $label; this label is to be passed as a parameter to gen-ballot.pl and updated near the top of web-ballot.pl. The generated votes.txt file contains this in its filename.

Copy names-sample.txt to names.txt or create your own names.txt. Clobber your ~/votes $label.txt file.

Generating Ballots

./gen-ballot.pl 15 "testovaci komise" <names.txt >tokens.txt

Web Ballot CGI Script

Put names.txt and tokens.txt to the same directory as web-ballot.pl and make that directory available for CGI script execution. If this directory is accessible over web, don't forget to remove read permissions for all but the owner.

After updating the "$label" setting in web-ballot.pl, it should just work; you may need to adjust the votes.txt path currently hardcoded in web-ballot.pl, where the cast votes are recorded.

Counting Votes

This script will show just the final vote for each token:

perl -nle 'chomp; @b = split/,/; $a{$b[0]} = [@b]; END { for (values %a) { print join(",", @$_); } }' ~/'votes testovaci komise'.txt >finalvotes.txt

Append votes from collected paper ballots, one line per ballot, with numbers for each candidate as entered (use 0 in place of numbers not entered for a particular candidate).

Then, build input for hlas.pl - a text file, that has:

NUMBER_OF_ELECTED_CANDIDATES  (1 for predseda, 3 or 5 or 7 for rada, ...)
<names.txt>

<cat finalvotes.txt | cut -d, -f 2- | tr , ' '>

0

(See hlas-example.txt for an example.)

Then, run hlas.pl < textfile and there you go!

Drawing Lots

If you see Chybi zaznam o losovani. there was a tie. Draw a random vote and look at the number of the candidate who was assigned number one (1) on this ballot. Enter this number after the last empty line (before the final "0" line) and run hlas.pl again.