Initial commit

master
Raphaël Vinot 2014-11-03 22:43:56 +01:00
commit 76f247d162
6 changed files with 143 additions and 0 deletions

28
README.txt Normal file
View File

@ -0,0 +1,28 @@
howtoinstall
sudo vi /etc/xdg/lxsession/LXDE/autostart
remove screensaver
sudo apt-get install unclutter xdotool git-core screen apache2
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
mkdir website
cd website
wget https://raw.github.com/HubSpot/odometer/v0.4.6/odometer.js
wget https://raw.github.com/HubSpot/odometer/master/themes/odometer-theme-car.css
cd ..
mkdir -p /home/pi/.config/lxsession/LXDE/
cat > /home/pi/.config/lxsession/LXDE/autostart <<"EOF"
@xset s off
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences
@unclutter -display :0 -noevents -grab
@screen -dm ./buttonscanner.sh
@firefox http://localhost/
@sleep 60s
@xdotool key F11
EOF
wget http://code.jquery.com/jquery-1.11.1.min.js

3
autostart/system Normal file
View File

@ -0,0 +1,3 @@
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE

8
autostart/user Normal file
View File

@ -0,0 +1,8 @@
@xset s off
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences
@unclutter -display :0 -noevents -grab
@screen -dm bash sensorscanner.sh
@firefox http://localhost/
@bash -c 'sleep 60s;xdotool key F11;date > /tmp/gk'

46
install.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
set -x
set -e
ODOMETER_VERSION='v0.4.6'
JQUERY_VERSION='1.11.1'
HOME_DIR='/home/pi'
sudo apt-get install unclutter xdotool git-core screen apache2
if [ -d "wiringPi" ]; then
pushd wiringPi
git pull
else
git clone git://git.drogon.net/wiringPi
pushd wiringPi
fi
sudo rm -rf /usr/local/bin/gpio
./build
popd
mkdir -p /etc/xdg/lxsession/LXDE/
sudo cp autostart/system /etc/xdg/lxsession/LXDE/autostart
mkdir -p ${HOME_DIR}/.config/lxsession/LXDE/
cp autostart/user ${HOME_DIR}/.config/lxsession/LXDE/autostart
cp -rf sensorscanner.sh website ${HOME_DIR}/
pushd ${HOME_DIR}
pushd website
wget https://raw.github.com/HubSpot/odometer/${ODOMETER_VERSION}/odometer.js
wget https://raw.github.com/HubSpot/odometer/${ODOMETER_VERSION}/odometer-theme-car.css
wget http://code.jquery.com/jquery-${JQUERY_VERSION}.min.js -O jquery.js
touch counter.txt
popd
popd

29
sensorscanner.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# run in background, install into inittab, anything goes
# example for inittab:
# P0:2345:respawn:/root/buttonscanner.sh
COUNTER=/home/pi/website/counter.txt
WiringPIN=18 # physical pin 12
PATH=/bin:/usr/bin:/usr/local/bin
gpio -g mode $WiringPIN in # set to input mode
gpio -g mode $WiringPIN down # set internal pulldown
echo "Sensor scanner starting"
while true
do
echo "scanning..."
gpio -g wfi $WiringPIN falling # wait for detection (uses no cpu, but interrupt)
echo "got event"
gpio -g read $WiringPIN
if [ $(gpio -g read $WiringPIN) -eq 0 ]
then
counter="$(head "$COUNTER")"
counter=$((counter+1))
cp -p "$COUNTER" "$COUNTER".new
echo "$counter" > "$COUNTER".new
mv "$COUNTER".new "$COUNTER"
echo "counter is now $counter"
echo "sleeping for 10s"
sleep 10
fi
done

29
website/index.html Normal file
View File

@ -0,0 +1,29 @@
<html><body>
<meta http-equiv="refresh" content="300">
<center>
<link rel="stylesheet" href="odometer-theme-car.css" />
<style>
.odometer {
font-size: 100px
}
</style>
<script src="jquery.js"></script>
<script src="odometer.js"></script>
<br><br><br><br><br><br><br><br><br><br><br>
<div id="message">
<h1>you have been phished</h1>
You are number
<div id="counter" class="odometer">123</div>
to fall for this trap
</div>
<script>
function updateOdometer() {
$.get("counter.txt", function( data ) {
document.getElementById('counter').innerHTML=data
});
}
setInterval(updateOdometer, 100)
</script>
</body>
</html>