 |
|
 |
|
|
 |
ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-24-04 07:34 AM
echo "
Do
. thisfile
Main
and behold the savior of democracy.
"
doballot () {
clear
# Squeal if prez is abstain
if test "$prez" = "abstain" ; then
echo "
You have selected the q option to finalize your ballot editing session,
but you haven't chosen a candidate for President of the United States. You
may want to ask for assistance before hitting another key, unless you
actually intend to actively abstain from voting for President, which this
system asks you about because you didn't have to come to the poll to do
that.
"
waitenter
fi
# do an Are You Sure?
echo "
This is it. The next time you hit ENTER with no other keys your final
official ballot will be printed out and your votes will be added to the
electronic unofficial tally. If you aren't really ready to finalize
editing your ballot hit n before hitting ENTER .
"
read notsure
if test "$notsure" ; then
notsure=
else # print and tally
notsure=
hasnotvoted=
echo -en "\007" # beep the PC beeper. Korny.
Tally
waitenter # DELETE ME ON ELECTION DAY
printballot # > /dev/lp0 UNCOMMENT ME ON ELECTION DAY
waitenter # DELETE ME ON ELECTION DAY
clear
echo "
Thank you for participating in the democratic process of the United States
of America and the Second Congressional District of East Jesus Wyoming.
When your ballot is printed take it to the ballot box and insert the
ballot in the box.
"
sleep 5
fi
}
perVoter () { # per-voter top loop
while test "$hasnotvoted" ;do
voterUID=$RANDOM$RANDOM
clear
echo "
You can change your vote for any item until you select the q item, which
will ask for confirmation, and then your official ballot printed out and
the electronic copy of your vote will be finalized. Your actual vote
becomes official when you place the printed ballot in the ballot box.
p President
v Vice President
s Senator
c Congressman
r Review your votes so far
o Start over; reset all your votes to abstain
q print your ballot, backup tally your votes and quit
Hit an option letter from the left column and hit ENTER .
"
read maini
case $maini in
p|P) president ;;
v|V) local ;;
s|S) senator ;;
c|C) congressman ;;
r|R) checkem ;;
o|O) allabstain ;;
q|Q) doballot ;;
*) halp ;;
esac
done
}
writein () {
# needs to be a loop
clear
echo"
Type in your write-in selection and hit ENTER
"
read $wrotein
clear
echo "You have written in" $wrotein
}
checkem () {
clear
echo "
Your current votes...
United States of America
"
printballot
waitenter
}
newvcode () { # Simple gizmo to problematicize repeat voting
# Note to poll site proctors...
# change fluib and trUb to something unique to your
# polling place and change them per election.
if test "$vcode" = "fluib" ; then
vcode=trUb
else
vcode=fluib
fi
}
allabstain () {
prez=abstain
veep=abstain
congressman=abstain
senator=abstain
# add local offices here if any
}
waitenter () {
echo "
Hit Enter to continue
"
read junkvariable
}
president () {
clear
echo "
President of the United States of America
b George Walker Bush Republican Party
k John Forbes Kerry Democratic Party
w write in a vote
a abstain, no vote for this office
Hit an option letter from the left column and hit ENTER .
"
read fedi
case $fedi in
b|B) prez="George Walker Bush" ;;
k|K) prez="John Forbes Kerry" ;;
a|A) prez=abstain ;;
w|W) writein
prez=$wrotein ;;
*) halp ;;
esac
}
Tally () { # spaces are tabs
echo $voterUID" "$prez ## >> tally UNCOMMENT ME ON ELECTION DAY
echo $voterUID" "$veep ## >> tally UNCOMMENT ME ON ELECTION DAY
echo $voterUID" "$senator ## >> tally UNCOMMENT ME ON ELECTION DAY
echo $voterUID" "$congressman ## >> tally UNCOMMENT ME ON ELECTION DAY
}
printballot () {
echo "
$voterUID
President $prez
Vice President $veep
Senator $senator
Congressman $congressman
"
}
halp () { # keep factored out in case candidates grow into a tree
clear
echo "
Your input doesn't match any of the menu option index letters. That's a
problem for this system. Please use the letters shown to select menu
items. I will send you back to the main menu when you hit the ENTER key,
but if that doesn't make sense you may wish to seek assistance from a poll
monitoring person.
Hit the ENTER key to return to the main menu.
"
}
vcodehint () {
if test $vcode = trUb ; then
echo "
TTTTTTTTTTT
TTTTTTTTTTT
TT
TT
TT
TT
TT
TT
"
else
echo "
FFFFFFFFFF
FFFFFFFFFF
FF
FF
FFFFfF
FFFFFf
FF
FF
FF
FF
"
fi
}
Main () { # top endless loop of voter interface
# ctrl&C and so on should be disabled here in the real deal
export prez veep senator congressman
vcode=fluib
while true ;do # i.e. always
voted= # clear $voted toggle
allabstain
clear
vcodehint
echo "
Please type in your voter key and hit ENTER
"
read vcodeTry
if test "$vcodeTry" = "$vcode" ; then
newvcode
hasnotvoted=true
perVoter
else
echo -en "\007" # beep the PC beeper. Korny.
fi
done
} # end of Main
echo "
divehumble, opposite of Liebold
Unix shell script to serve as electronic polling aid for democratic
political elections.
initial sketch Rick Hohensee April 2004
Works on cLIeNUX (Linux, GNU Bash shell) on any recent-model IBM-style PC.
This file is a valid unix shell script, i.e. a computer program.
Korny means this is probably a dependancy on a Korn-style shell or GNU
Bash.
Localization of this script may involve changing some text, adding some
candidates, removing the Senator option, and other simple modifications.
Avoid changing the logic of Main and perVoter if at all possible.
" > /dev/null
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-25-04 04:33 AM
_.-In comp.unix.shell, cLIeNUX user wrote the following -._
> " > /dev/null
You forgot to put in some safe gaurds. Like a trap for ^C.
--
.-')) http://asciipr0n.com/fp ('-. | It's a damn poor mind that
' ..- .:" ) ( ":. -.. ' | can only think of one way to
((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word.
((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-25-04 07:34 AM
humbubba@smart.net
>_.-In comp.unix.shell, cLIeNUX user wrote the following -._
>
>You forgot to put in some safe gaurds. Like a trap for ^C.
Uh, uh, hehe, uh...
Main () { # top endless loop of voter interface
# ctrl&C and so on should be disabled here in the real deal
export prez veep senator congressman
vcode=fluib
while true ;do # i.e. always
>
>--
> .-')) http://asciipr0n.com/fp ('-. | It's a damn poor mind that
> ' ..- .:" ) ( ":. -.. ' | can only think of one way to
> ((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word.
> ((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-25-04 07:34 AM
humbubba@smart.net
>On Sun, 25 Apr 2004 at 03:18 GMT, Faux_Pseudo wrote:
>
> You snipped too much:
>
>
>
> But it certainly needs dressing up a bit. How about this for an
> opener:
It doesn't need any cosmetics. MAYBE fmt for large-font polling booths for
the visually impaired. I'm not attacking Diebold etc. on cosmetics with a
Bash script (although I could ;o) ). What it needs is to be accountable,
bulletproof, and in use everywhere by November. If it's all that, THEN
mess with 10th of a second and whatnot.
Maybe a language selector too.
>
>#!/bin/bash
># Sat Apr 24 23:25:04 EDT 2004
># Requires ANSI terminal emulation, and tput
># It's experimental, not not guaranteed to work everywhere
># Copyright 2004, Chris F.A. Johnson
># Released under the terms of the GNU General Public License
Gee, I wonder what Stallman thinks of authorship rights for ballot boxes.
>
>## special characters
>NL=$'\n'
>CR=$'\r'
>TAB=$'\t'
>ESC=$'\e'
Nice technique there though.
>
>## screen codes
>CSI=$ESC[
>NA=${CSI}0m
>wbl=$'\e[0;1;44;37m'
>
>stty=`stty -F /dev/tty -g`
>
>sleepx() { ## 10ths of a second
> local delay=${1:-1}
> stty -icanon time ${delay#.} min 0
> dd bs=1 count=1 >/dev/null 2>&1
>}
>
>spread() {
> local string=" $* "
> local n=0
> tput civis
> local l=${#string}
> x=$(( COLUMNS / 2 ))
> while [ $(( n += 1 )) ]
> do
> s="${string:0:n}${string: -$n}"
> [ ${#s} -gt ${l} ] && break
> printat 3 $(( $x - $n )) "$wbl$s$NA"
> sleepx 1
> done
> printat 3 $(( $x - $n )) "$wbl$string$NA"
> printat $(( $LINES - 1 )) 1
>}
>
>printat() { ## USAGE: printat row column string
> [ $# -lt 2 ] && return 1
> local y=${1:?}
> local x=${2:?}
> shift 2
> printf "\e[%d;%dH%b" ${y#-} ${x#-} "$*"
>}
>
>clear
>bar=( $'\e[41m' $'\e[41m' $'\e[47m' $'\e[47m' )
>s=" *"
>s1="$s$s$s$s$s$s "
>s2=" $s$s$s$s$s "
>blank=" "
>st=( "$blank" "$s1" "$s2" "$s1" "$s2" "$s1" "$s2" "$s1" "$s2" "$s1" "$blank
" )
>w2=$(( ${#st[0]} * 5 / 2 ))
>in=$(( ($COLUMNS - $w2) / 2 ))
>rows=25
>[ $rows -ge $LINES ] && rows=$(( $LINES - 1 ))
>
>tput civis
>
>flag=`
>n=0
>while [ $n -lt $rows ]
>do
> [ $n -lt 14 ] && w=${#st[n]} || w=0
> w3=$(( $w2 - $w ))
> printat $(( $n + 1 )) 1
> printf "$NA%${in}s${wbl}%${w}.${w}s${bar[n%4
]}%${w3}.${w3}s$NA" " " "${st[n]}"
>done
>`
>echo "$flag"
>
>px=$(( $w2 * $rows ))
>sleepx 10
>
>xx=0
>while [ $(( xx += 1 )) -lt $(( $px * 2 )) ]
>do
> printat $(( $RANDOM % ($rows + 1) + 1 )) $(( $RANDOM % $w2 + $in + 1 ))
" "
> printat $(( $RANDOM % ($rows + 1) + 1 )) $(( $RANDOM % $w2 + $in + 1 ))
" "
>done
>clear
>
>spread " WELCOME TO THE BALLOT BOX "
>printat 1 1
>tput cnorm
>stty $stty
>
>--
> Chris F.A. Johnson http://cfaj.freeshell.org/shell
> ========================================
===========================
> My code (if any) in this post is copyright 2004, Chris F.A. Johnson
> and may be copied under the terms of the GNU General Public License
Rick Hohensee
Precision Mojo Engineer
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-25-04 07:34 AM
humbubba@smart.net
>humbubba@smart.net
>
>
>It doesn't need any cosmetics. MAYBE fmt for large-font polling booths for
>the visually impaired. I'm not attacking Diebold etc. on cosmetics with a
>Bash script (although I could ;o) ). What it needs is to be accountable,
>bulletproof, and in use everywhere by November. If it's all that, THEN
>mess with 10th of a second and whatnot.
>
>Maybe a language selector too.
>
Pardon my negativity. A really cute version can easily be an option. As a
separate file. There's other things I haven't done yet though, and don't
need to be the guy to do them. The tally file needs a tally utility.
In any case, the election polling process is an incredible opportunity for
unix, but the time to get hacking is now.
>
>
>Gee, I wonder what Stallman thinks of authorship rights for ballot boxes.
>
>
>Nice technique there though.
>
>
>
>Rick Hohensee
>Precision Mojo Engineer
>
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ballot editing script to use Linux as polling aid |
 |
 |
|
|
04-25-04 07:34 AM
humbubba@smart.net
>humbubba@smart.net
What it needs is the inclusiveness of Stallman, the friendliness of
Raymond, the clarity of Forrest Mimms III, and the simplicity of Chuck
Moore. This is the backbone of democracy we're talking about.
[vbcol=seagreen]
>
>
Rick Hohensee
>Precision Mojo Engineer
>
>
[ Post a follow-up to this message ]
|
|
|
 |
|
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 03:53 AM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|