Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial Commit

  • Loading branch information...
commit 5be3c5e31f385dda3706e93142fb473c4b921323 0 parents
Brad Luyster authored
58 README.md
Source Rendered
... ... @@ -0,0 +1,58 @@
  1 +SOPA Box
  2 +========
  3 +
  4 +*Stop Online Productivity Avoidance*
  5 +
  6 +The SOPA box disables distracting websites. Pressing the red button toggles these sites on and off, while turning the key switch and pressing the red button disables these sites for 1 hour with no option to return to normal. Resetting the router will bring the internet back, but my cheap crappy router takes 15 minutes to restart, so that's incentive enough to not restart it.
  7 +
  8 +File Description
  9 +----------------
  10 +
  11 +* box*.svg
  12 +
  13 + Files for laser cutting your own box. Files are for 5.2mm plywood.
  14 +
  15 +* eternalduino_ino.ino
  16 +
  17 + Arduino source files. These are embarrassingly badly written.
  18 +
  19 +* eternal.py
  20 +
  21 + Python script for shutting off the internet. Uses pySerial.
  22 + List of sites is in here.
  23 +
  24 +Materials
  25 +---------
  26 +
  27 +* Plywood box with holes
  28 +* Arduino
  29 +* Key Switch
  30 +
  31 + ($0.95, [http://www.sparkfun.com/products/10445](http://www.sparkfun.com/products/10445))
  32 +
  33 +* Arcade Button
  34 +
  35 + ($1.95, [http://www.sparkfun.com/products/9336](http://www.sparkfun.com/products/9336))
  36 +
  37 +* Serial 7-segment display
  38 +
  39 + ($12.95, [http://www.sparkfun.com/products/9766](http://www.sparkfun.com/products/9766))
  40 +
  41 +* Piezo Buzzer
  42 +* Resistors
  43 +* Wire
  44 +
  45 +Arduino Details
  46 +---------------
  47 +
  48 +* Piezo on pin D10
  49 +* 7 Segment on pin D9
  50 +* Button on pin D5
  51 +* Key on pin D4
  52 +
  53 +I have used the Software Serial library to interface with the seven segment display. Unfortunately, this requires modifying the SoftSerial source code to accommodate interrupts on digital pins 0-5 (for the buttons). In /Arduino-1.0/Libraries/SoftwareSerial/SoftwareSerial.cpp, simply comment out lines 315-320. This disables software serial on pins D0-D7.
  54 +
  55 +Router Details
  56 +--------------
  57 +
  58 +My router is a Soekris Net4801 running [Voyage Linux](http://linux.voyage.hk/). Also installed are Python, DHCP3-Server and the Squid3 Proxy. [This](http://www.tuxgarage.com/2011/01/how-to-setup-transparent-proxy-with.html) guide can get you up and running with these programs.
104 box4sheet1.svg
... ... @@ -0,0 +1,104 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
  3 +
  4 +<svg
  5 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  6 + xmlns:cc="http://creativecommons.org/ns#"
  7 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  8 + xmlns:svg="http://www.w3.org/2000/svg"
  9 + xmlns="http://www.w3.org/2000/svg"
  10 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  11 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  12 + width="1440"
  13 + height="1080"
  14 + id="svg3995"
  15 + version="1.1"
  16 + inkscape:version="0.48.2 r9819"
  17 + sodipodi:docname="New document 10">
  18 + <defs
  19 + id="defs3997" />
  20 + <sodipodi:namedview
  21 + id="base"
  22 + pagecolor="#ffffff"
  23 + bordercolor="#666666"
  24 + borderopacity="1.0"
  25 + inkscape:pageopacity="0.0"
  26 + inkscape:pageshadow="2"
  27 + inkscape:zoom="0.35"
  28 + inkscape:cx="462.36838"
  29 + inkscape:cy="361.34188"
  30 + inkscape:document-units="px"
  31 + inkscape:current-layer="layer1"
  32 + showgrid="false"
  33 + units="in"
  34 + inkscape:window-width="1366"
  35 + inkscape:window-height="744"
  36 + inkscape:window-x="0"
  37 + inkscape:window-y="24"
  38 + inkscape:window-maximized="1" />
  39 + <metadata
  40 + id="metadata4000">
  41 + <rdf:RDF>
  42 + <cc:Work
  43 + rdf:about="">
  44 + <dc:format>image/svg+xml</dc:format>
  45 + <dc:type
  46 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  47 + <dc:title></dc:title>
  48 + </cc:Work>
  49 + </rdf:RDF>
  50 + </metadata>
  51 + <g
  52 + inkscape:label="Layer 1"
  53 + inkscape:groupmode="layer"
  54 + id="layer1"
  55 + transform="translate(0,27.64025)">
  56 + <polyline
  57 + transform="matrix(3.5433069,0,0,3.5433069,-240.39812,132.0266)"
  58 + points="99.60000000000001,4 104.60000000000001,4 104.60000000000001,-1.2000000000000002 114.60000000000001,-1.2000000000000002 114.60000000000001,4 119.60000000000001,4 124.60000000000001,4 124.60000000000001,-1.2000000000000002 134.60000000000002,-1.2000000000000002 134.60000000000002,4 139.60000000000002,4 144.60000000000002,4 144.60000000000002,-1.2000000000000002 154.60000000000002,-1.2000000000000002 154.60000000000002,4 159.60000000000002,4 164.60000000000002,4 164.60000000000002,-1.2000000000000002 174.60000000000002,-1.2000000000000002 174.60000000000002,4 179.60000000000002,4 184.60000000000002,4 184.60000000000002,-1.2000000000000002 194.60000000000002,-1.2000000000000002 194.60000000000002,4 199.60000000000002,4 204.60000000000002,4 204.60000000000002,-1.2000000000000002 214.60000000000002,-1.2000000000000002 214.60000000000002,4 219.60000000000002,4 224.60000000000002,4 224.60000000000002,-1.2000000000000002 234.60000000000002,-1.2000000000000002 234.60000000000002,4 239.60000000000002,4 244.60000000000002,4 244.60000000000002,-1.2000000000000002 254.60000000000002,-1.2000000000000002 254.60000000000002,4 259.6,4 259.6,9 264.8,9 264.8,19 259.6,19 259.6,24 259.6,29 264.8,29 264.8,39 259.6,39 259.6,44 259.6,49 264.8,49 264.8,59 259.6,59 259.6,64 259.6,69 264.8,69 264.8,79 259.6,79 259.6,84 259.6,89 264.8,89 264.8,99 259.6,99 259.6,104 254.60000000000002,104 254.60000000000002,109.2 244.60000000000002,109.2 244.60000000000002,104 239.60000000000002,104 234.60000000000002,104 234.60000000000002,109.2 224.60000000000002,109.2 224.60000000000002,104 219.60000000000002,104 214.60000000000002,104 214.60000000000002,109.2 204.60000000000002,109.2 204.60000000000002,104 199.60000000000002,104 194.60000000000002,104 194.60000000000002,109.2 184.60000000000002,109.2 184.60000000000002,104 179.60000000000002,104 174.60000000000002,104 174.60000000000002,109.2 164.60000000000002,109.2 164.60000000000002,104 159.60000000000002,104 154.60000000000002,104 154.60000000000002,109.2 144.60000000000002,109.2 144.60000000000002,104 139.60000000000002,104 134.60000000000002,104 134.60000000000002,109.2 124.60000000000002,109.2 124.60000000000002,104 119.60000000000002,104 114.60000000000002,104 114.60000000000002,109.2 104.60000000000002,109.2 104.60000000000002,104 99.60000000000002,104 99.60000000000002,99 94.40000000000002,99 94.40000000000002,89 99.60000000000002,89 99.60000000000002,84 99.60000000000002,79 94.40000000000002,79 94.40000000000002,69 99.60000000000002,69 99.60000000000002,64 99.60000000000002,59 94.40000000000002,59 94.40000000000002,49 99.60000000000002,49 99.60000000000002,44 99.60000000000002,39 94.40000000000002,39 94.40000000000002,29 99.60000000000002,29 99.60000000000002,24 99.60000000000002,19 94.40000000000002,19 94.40000000000002,9 99.60000000000002,9 99.60000000000002,4 "
  59 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  60 + id="polyline3045" />
  61 + <polyline
  62 + transform="matrix(3.5433069,0,0,3.5433069,-240.39812,114.0266)"
  63 + points="94.4,114.4 99.60000000000001,114.4 104.60000000000001,114.4 104.60000000000001,119.60000000000001 114.60000000000001,119.60000000000001 114.60000000000001,114.4 119.60000000000001,114.4 124.60000000000001,114.4 124.60000000000001,119.60000000000001 134.60000000000002,119.60000000000001 134.60000000000002,114.4 139.60000000000002,114.4 144.60000000000002,114.4 144.60000000000002,119.60000000000001 154.60000000000002,119.60000000000001 154.60000000000002,114.4 159.60000000000002,114.4 164.60000000000002,114.4 164.60000000000002,119.60000000000001 174.60000000000002,119.60000000000001 174.60000000000002,114.4 179.60000000000002,114.4 184.60000000000002,114.4 184.60000000000002,119.60000000000001 194.60000000000002,119.60000000000001 194.60000000000002,114.4 199.60000000000002,114.4 204.60000000000002,114.4 204.60000000000002,119.60000000000001 214.60000000000002,119.60000000000001 214.60000000000002,114.4 219.60000000000002,114.4 224.60000000000002,114.4 224.60000000000002,119.60000000000001 234.60000000000002,119.60000000000001 234.60000000000002,114.4 239.60000000000002,114.4 244.60000000000002,114.4 244.60000000000002,119.60000000000001 254.60000000000002,119.60000000000001 254.60000000000002,114.4 259.6,114.4 259.6,119.60000000000001 259.6,124.60000000000001 264.8,124.60000000000001 264.8,134.60000000000002 259.6,134.60000000000002 259.6,139.60000000000002 259.6,144.60000000000002 264.8,144.60000000000002 264.8,154.60000000000002 259.6,154.60000000000002 259.6,159.60000000000002 259.6,164.60000000000002 264.8,164.60000000000002 264.8,174.60000000000002 259.6,174.60000000000002 259.6,179.60000000000002 259.6,184.60000000000002 264.8,184.60000000000002 264.8,194.60000000000002 259.6,194.60000000000002 259.6,199.60000000000002 259.6,204.8 254.60000000000002,204.8 254.60000000000002,199.60000000000002 244.60000000000002,199.60000000000002 244.60000000000002,204.8 239.60000000000002,204.8 234.60000000000002,204.8 234.60000000000002,199.60000000000002 224.60000000000002,199.60000000000002 224.60000000000002,204.8 219.60000000000002,204.8 214.60000000000002,204.8 214.60000000000002,199.60000000000002 204.60000000000002,199.60000000000002 204.60000000000002,204.8 199.60000000000002,204.8 194.60000000000002,204.8 194.60000000000002,199.60000000000002 184.60000000000002,199.60000000000002 184.60000000000002,204.8 179.60000000000002,204.8 174.60000000000002,204.8 174.60000000000002,199.60000000000002 164.60000000000002,199.60000000000002 164.60000000000002,204.8 159.60000000000002,204.8 154.60000000000002,204.8 154.60000000000002,199.60000000000002 144.60000000000002,199.60000000000002 144.60000000000002,204.8 139.60000000000002,204.8 134.60000000000002,204.8 134.60000000000002,199.60000000000002 124.60000000000002,199.60000000000002 124.60000000000002,204.8 119.60000000000002,204.8 114.60000000000002,204.8 114.60000000000002,199.60000000000002 104.60000000000002,199.60000000000002 104.60000000000002,204.8 99.60000000000002,204.8 94.40000000000002,204.8 94.40000000000002,199.60000000000002 94.40000000000002,194.60000000000002 99.60000000000002,194.60000000000002 99.60000000000002,184.60000000000002 94.40000000000002,184.60000000000002 94.40000000000002,179.60000000000002 94.40000000000002,174.60000000000002 99.60000000000002,174.60000000000002 99.60000000000002,164.60000000000002 94.40000000000002,164.60000000000002 94.40000000000002,159.60000000000002 94.40000000000002,154.60000000000002 99.60000000000002,154.60000000000002 99.60000000000002,144.60000000000002 94.40000000000002,144.60000000000002 94.40000000000002,139.60000000000002 94.40000000000002,134.60000000000002 99.60000000000002,134.60000000000002 99.60000000000002,124.60000000000002 94.40000000000002,124.60000000000002 94.40000000000002,119.60000000000002 94.40000000000002,114.40000000000002 "
  64 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  65 + id="polyline3047" />
  66 + <polyline
  67 + transform="matrix(3.5433069,0,0,3.5433069,370.90697,-616.14125)"
  68 + points="99.60000000000001,215.20000000000002 104.60000000000001,215.20000000000002 104.60000000000001,210.00000000000003 114.60000000000001,210.00000000000003 114.60000000000001,215.20000000000002 119.60000000000001,215.20000000000002 124.60000000000001,215.20000000000002 124.60000000000001,210.00000000000003 134.60000000000002,210.00000000000003 134.60000000000002,215.20000000000002 139.60000000000002,215.20000000000002 144.60000000000002,215.20000000000002 144.60000000000002,210.00000000000003 154.60000000000002,210.00000000000003 154.60000000000002,215.20000000000002 159.60000000000002,215.20000000000002 164.60000000000002,215.20000000000002 164.60000000000002,210.00000000000003 174.60000000000002,210.00000000000003 174.60000000000002,215.20000000000002 179.60000000000002,215.20000000000002 184.60000000000002,215.20000000000002 184.60000000000002,210.00000000000003 194.60000000000002,210.00000000000003 194.60000000000002,215.20000000000002 199.60000000000002,215.20000000000002 204.60000000000002,215.20000000000002 204.60000000000002,210.00000000000003 214.60000000000002,210.00000000000003 214.60000000000002,215.20000000000002 219.60000000000002,215.20000000000002 224.60000000000002,215.20000000000002 224.60000000000002,210.00000000000003 234.60000000000002,210.00000000000003 234.60000000000002,215.20000000000002 239.60000000000002,215.20000000000002 244.60000000000002,215.20000000000002 244.60000000000002,210.00000000000003 254.60000000000002,210.00000000000003 254.60000000000002,215.20000000000002 259.6,215.20000000000002 259.6,220.20000000000002 264.8,220.20000000000002 264.8,230.20000000000002 259.6,230.20000000000002 259.6,235.20000000000002 259.6,240.20000000000002 264.8,240.20000000000002 264.8,250.20000000000002 259.6,250.20000000000002 259.6,255.20000000000002 259.6,260.20000000000005 264.8,260.20000000000005 264.8,270.20000000000005 259.6,270.20000000000005 259.6,275.20000000000005 259.6,280.20000000000005 264.8,280.20000000000005 264.8,290.20000000000005 259.6,290.20000000000005 259.6,295.20000000000005 259.6,300.20000000000005 264.8,300.20000000000005 264.8,310.20000000000005 259.6,310.20000000000005 259.6,315.20000000000005 254.60000000000002,315.20000000000005 254.60000000000002,320.40000000000003 244.60000000000002,320.40000000000003 244.60000000000002,315.20000000000005 239.60000000000002,315.20000000000005 234.60000000000002,315.20000000000005 234.60000000000002,320.40000000000003 224.60000000000002,320.40000000000003 224.60000000000002,315.20000000000005 219.60000000000002,315.20000000000005 214.60000000000002,315.20000000000005 214.60000000000002,320.40000000000003 204.60000000000002,320.40000000000003 204.60000000000002,315.20000000000005 199.60000000000002,315.20000000000005 194.60000000000002,315.20000000000005 194.60000000000002,320.40000000000003 184.60000000000002,320.40000000000003 184.60000000000002,315.20000000000005 179.60000000000002,315.20000000000005 174.60000000000002,315.20000000000005 174.60000000000002,320.40000000000003 164.60000000000002,320.40000000000003 164.60000000000002,315.20000000000005 159.60000000000002,315.20000000000005 154.60000000000002,315.20000000000005 154.60000000000002,320.40000000000003 144.60000000000002,320.40000000000003 144.60000000000002,315.20000000000005 139.60000000000002,315.20000000000005 134.60000000000002,315.20000000000005 134.60000000000002,320.40000000000003 124.60000000000002,320.40000000000003 124.60000000000002,315.20000000000005 119.60000000000002,315.20000000000005 114.60000000000002,315.20000000000005 114.60000000000002,320.40000000000003 104.60000000000002,320.40000000000003 104.60000000000002,315.20000000000005 99.60000000000002,315.20000000000005 99.60000000000002,310.20000000000005 94.40000000000002,310.20000000000005 94.40000000000002,300.20000000000005 99.60000000000002,300.20000000000005 99.60000000000002,295.20000000000005 99.60000000000002,290.20000000000005 94.40000000000002,290.20000000000005 94.40000000000002,280.20000000000005 99.60000000000002,280.20000000000005 99.60000000000002,275.20000000000005 99.60000000000002,270.20000000000005 94.40000000000002,270.20000000000005 94.40000000000002,260.20000000000005 99.60000000000002,260.20000000000005 99.60000000000002,255.20000000000005 99.60000000000002,250.20000000000005 94.40000000000002,250.20000000000005 94.40000000000002,240.20000000000005 99.60000000000002,240.20000000000005 99.60000000000002,235.20000000000005 99.60000000000002,230.20000000000005 94.40000000000002,230.20000000000005 94.40000000000002,220.20000000000005 99.60000000000002,220.20000000000005 99.60000000000002,215.20000000000005 "
  69 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  70 + id="polyline3049" />
  71 + <polyline
  72 + transform="matrix(3.5433069,0,0,3.5433069,370.90697,-634.14125)"
  73 + points="99.60000000000001,325.6 104.60000000000001,325.6 104.60000000000001,330.8 114.60000000000001,330.8 114.60000000000001,325.6 119.60000000000001,325.6 124.60000000000001,325.6 124.60000000000001,330.8 134.60000000000002,330.8 134.60000000000002,325.6 139.60000000000002,325.6 144.60000000000002,325.6 144.60000000000002,330.8 154.60000000000002,330.8 154.60000000000002,325.6 159.60000000000002,325.6 164.60000000000002,325.6 164.60000000000002,330.8 174.60000000000002,330.8 174.60000000000002,325.6 179.60000000000002,325.6 184.60000000000002,325.6 184.60000000000002,330.8 194.60000000000002,330.8 194.60000000000002,325.6 199.60000000000002,325.6 204.60000000000002,325.6 204.60000000000002,330.8 214.60000000000002,330.8 214.60000000000002,325.6 219.60000000000002,325.6 224.60000000000002,325.6 224.60000000000002,330.8 234.60000000000002,330.8 234.60000000000002,325.6 239.60000000000002,325.6 244.60000000000002,325.6 244.60000000000002,330.8 254.60000000000002,330.8 254.60000000000002,325.6 259.6,325.6 264.8,325.6 264.8,330.8 264.8,335.8 259.6,335.8 259.6,345.8 264.8,345.8 264.8,350.8 264.8,355.8 259.6,355.8 259.6,365.8 264.8,365.8 264.8,370.8 264.8,375.8 259.6,375.8 259.6,385.8 264.8,385.8 264.8,390.8 264.8,395.8 259.6,395.8 259.6,405.8 264.8,405.8 264.8,410.8 264.8,416 259.6,416 254.60000000000002,416 254.60000000000002,410.8 244.60000000000002,410.8 244.60000000000002,416 239.60000000000002,416 234.60000000000002,416 234.60000000000002,410.8 224.60000000000002,410.8 224.60000000000002,416 219.60000000000002,416 214.60000000000002,416 214.60000000000002,410.8 204.60000000000002,410.8 204.60000000000002,416 199.60000000000002,416 194.60000000000002,416 194.60000000000002,410.8 184.60000000000002,410.8 184.60000000000002,416 179.60000000000002,416 174.60000000000002,416 174.60000000000002,410.8 164.60000000000002,410.8 164.60000000000002,416 159.60000000000002,416 154.60000000000002,416 154.60000000000002,410.8 144.60000000000002,410.8 144.60000000000002,416 139.60000000000002,416 134.60000000000002,416 134.60000000000002,410.8 124.60000000000002,410.8 124.60000000000002,416 119.60000000000002,416 114.60000000000002,416 114.60000000000002,410.8 104.60000000000002,410.8 104.60000000000002,416 99.60000000000002,416 99.60000000000002,410.8 99.60000000000002,405.8 94.40000000000002,405.8 94.40000000000002,395.8 99.60000000000002,395.8 99.60000000000002,390.8 99.60000000000002,385.8 94.40000000000002,385.8 94.40000000000002,375.8 99.60000000000002,375.8 99.60000000000002,370.8 99.60000000000002,365.8 94.40000000000002,365.8 94.40000000000002,355.8 99.60000000000002,355.8 99.60000000000002,350.8 99.60000000000002,345.8 94.40000000000002,345.8 94.40000000000002,335.8 99.60000000000002,335.8 99.60000000000002,330.8 99.60000000000002,325.6 "
  74 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  75 + id="polyline3051" />
  76 + <path
  77 + sodipodi:type="arc"
  78 + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  79 + id="path3765"
  80 + sodipodi:cx="592.4455"
  81 + sodipodi:cy="969.80194"
  82 + sodipodi:rx="71.772034"
  83 + sodipodi:ry="71.772034"
  84 + d="m 664.21753,969.80194 a 71.772034,71.772034 0 1 1 -143.54407,0 71.772034,71.772034 0 1 1 143.54407,0 z"
  85 + transform="matrix(0.71089674,0,0,0.71089674,446.11741,-365.8853)" />
  86 + <path
  87 + sodipodi:type="arc"
  88 + style="fill:none;stroke:#000000;stroke-width:1.93099415;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  89 + id="path3767"
  90 + sodipodi:cx="891.5"
  91 + sodipodi:cy="968.48413"
  92 + sodipodi:rx="38.5"
  93 + sodipodi:ry="38.5"
  94 + d="m 930,968.48413 a 38.5,38.5 0 1 1 -77,0 38.5,38.5 0 1 1 77,0 z"
  95 + transform="matrix(0.51786798,0,0,0.51786798,731.60619,-178.00317)" />
  96 + <rect
  97 + style="fill:none;stroke:#000000;stroke-width:1.08979237;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  98 + id="rect3771"
  99 + width="147.7291"
  100 + height="52.059814"
  101 + x="933.42029"
  102 + y="653.68707" />
  103 + </g>
  104 +</svg>
74 box4sheet2.svg
... ... @@ -0,0 +1,74 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
  3 +
  4 +<svg
  5 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  6 + xmlns:cc="http://creativecommons.org/ns#"
  7 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  8 + xmlns:svg="http://www.w3.org/2000/svg"
  9 + xmlns="http://www.w3.org/2000/svg"
  10 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  11 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  12 + width="1440"
  13 + height="1080"
  14 + id="svg3995"
  15 + version="1.1"
  16 + inkscape:version="0.48.2 r9819"
  17 + sodipodi:docname="box4sheet1.svg">
  18 + <defs
  19 + id="defs3997" />
  20 + <sodipodi:namedview
  21 + id="base"
  22 + pagecolor="#ffffff"
  23 + bordercolor="#666666"
  24 + borderopacity="1.0"
  25 + inkscape:pageopacity="0.0"
  26 + inkscape:pageshadow="2"
  27 + inkscape:zoom="0.49497475"
  28 + inkscape:cx="523.94744"
  29 + inkscape:cy="432.71593"
  30 + inkscape:document-units="px"
  31 + inkscape:current-layer="layer1"
  32 + showgrid="false"
  33 + units="in"
  34 + inkscape:window-width="1366"
  35 + inkscape:window-height="744"
  36 + inkscape:window-x="0"
  37 + inkscape:window-y="24"
  38 + inkscape:window-maximized="1" />
  39 + <metadata
  40 + id="metadata4000">
  41 + <rdf:RDF>
  42 + <cc:Work
  43 + rdf:about="">
  44 + <dc:format>image/svg+xml</dc:format>
  45 + <dc:type
  46 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  47 + <dc:title></dc:title>
  48 + </cc:Work>
  49 + </rdf:RDF>
  50 + </metadata>
  51 + <g
  52 + inkscape:label="Layer 1"
  53 + inkscape:groupmode="layer"
  54 + id="layer1"
  55 + transform="translate(0,27.64025)">
  56 + <polyline
  57 + transform="matrix(3.5433069,0,0,3.5433069,220.76494,-435.89667)"
  58 + points="4,215.20000000000002 9,215.20000000000002 9,210.00000000000003 19,210.00000000000003 19,215.20000000000002 24,215.20000000000002 29,215.20000000000002 29,210.00000000000003 39,210.00000000000003 39,215.20000000000002 44,215.20000000000002 49,215.20000000000002 49,210.00000000000003 59,210.00000000000003 59,215.20000000000002 64,215.20000000000002 69,215.20000000000002 69,210.00000000000003 79,210.00000000000003 79,215.20000000000002 84,215.20000000000002 89.2,215.20000000000002 89.2,220.20000000000002 84,220.20000000000002 84,230.20000000000002 89.2,230.20000000000002 89.2,235.20000000000002 89.2,240.20000000000002 84,240.20000000000002 84,250.20000000000002 89.2,250.20000000000002 89.2,255.20000000000002 89.2,260.20000000000005 84,260.20000000000005 84,270.20000000000005 89.2,270.20000000000005 89.2,275.20000000000005 89.2,280.20000000000005 84,280.20000000000005 84,290.20000000000005 89.2,290.20000000000005 89.2,295.20000000000005 89.2,300.20000000000005 84,300.20000000000005 84,310.20000000000005 89.2,310.20000000000005 89.2,315.20000000000005 89.2,320.40000000000003 84,320.40000000000003 79,320.40000000000003 79,315.20000000000005 69,315.20000000000005 69,320.40000000000003 64,320.40000000000003 59,320.40000000000003 59,315.20000000000005 49,315.20000000000005 49,320.40000000000003 44,320.40000000000003 39,320.40000000000003 39,315.20000000000005 29,315.20000000000005 29,320.40000000000003 24,320.40000000000003 19,320.40000000000003 19,315.20000000000005 9,315.20000000000005 9,320.40000000000003 4,320.40000000000003 -1.2000000000000002,320.40000000000003 -1.2000000000000002,315.20000000000005 -1.2000000000000002,310.20000000000005 4,310.20000000000005 4,300.20000000000005 -1.2000000000000002,300.20000000000005 -1.2000000000000002,295.20000000000005 -1.2000000000000002,290.20000000000005 4,290.20000000000005 4,280.20000000000005 -1.2000000000000002,280.20000000000005 -1.2000000000000002,275.20000000000005 -1.2000000000000002,270.20000000000005 4,270.20000000000005 4,260.20000000000005 -1.2000000000000002,260.20000000000005 -1.2000000000000002,255.20000000000005 -1.2000000000000002,250.20000000000005 4,250.20000000000005 4,240.20000000000005 -1.2000000000000002,240.20000000000005 -1.2000000000000002,235.20000000000005 -1.2000000000000002,230.20000000000005 4,230.20000000000005 4,220.20000000000005 -1.2000000000000002,220.20000000000005 -1.2000000000000002,215.20000000000005 4,215.20000000000005 "
  59 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  60 + id="polyline3053" />
  61 + <polyline
  62 + transform="matrix(3.5433069,0,0,3.5433069,-406.73506,-435.89667)"
  63 + points="270,210 275.2,210 280.2,210 280.2,215.2 290.2,215.2 290.2,210 295.2,210 300.2,210 300.2,215.2 310.2,215.2 310.2,210 315.2,210 320.2,210 320.2,215.2 330.2,215.2 330.2,210 335.2,210 340.2,210 340.2,215.2 350.2,215.2 350.2,210 355.2,210 360.4,210 360.4,215.2 360.4,220.2 355.2,220.2 355.2,230.2 360.4,230.2 360.4,235.2 360.4,240.2 355.2,240.2 355.2,250.2 360.4,250.2 360.4,255.2 360.4,260.2 355.2,260.2 355.2,270.2 360.4,270.2 360.4,275.2 360.4,280.2 355.2,280.2 355.2,290.2 360.4,290.2 360.4,295.2 360.4,300.2 355.2,300.2 355.2,310.2 360.4,310.2 360.4,315.2 355.2,315.2 350.2,315.2 350.2,320.4 340.2,320.4 340.2,315.2 335.2,315.2 330.2,315.2 330.2,320.4 320.2,320.4 320.2,315.2 315.2,315.2 310.2,315.2 310.2,320.4 300.2,320.4 300.2,315.2 295.2,315.2 290.2,315.2 290.2,320.4 280.2,320.4 280.2,315.2 275.2,315.2 270,315.2 270,310.2 275.2,310.2 275.2,300.2 270,300.2 270,295.2 270,290.2 275.2,290.2 275.2,280.2 270,280.2 270,275.2 270,270.2 275.2,270.2 275.2,260.2 270,260.2 270,255.2 270,250.2 275.2,250.2 275.2,240.2 270,240.2 270,235.2 270,230.2 275.2,230.2 275.2,220.2 270,220.2 270,215.2 270,210 "
  64 + style="fill:none;stroke:#000000;stroke-width:0.28222224;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  65 + id="polyline3055" />
  66 + <rect
  67 + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  68 + id="rect4119"
  69 + width="53.25"
  70 + height="35.499996"
  71 + x="300.22464"
  72 + y="341.57254" />
  73 + </g>
  74 +</svg>
64 box4sheet3.svg
... ... @@ -0,0 +1,64 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
  3 +
  4 +<svg
  5 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  6 + xmlns:cc="http://creativecommons.org/ns#"
  7 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  8 + xmlns:svg="http://www.w3.org/2000/svg"
  9 + xmlns="http://www.w3.org/2000/svg"
  10 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  11 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  12 + width="1440"
  13 + height="1080"
  14 + id="svg3995"
  15 + version="1.1"
  16 + inkscape:version="0.48.2 r9819"
  17 + sodipodi:docname="box4sheet2.svg">
  18 + <defs
  19 + id="defs3997" />
  20 + <sodipodi:namedview
  21 + id="base"
  22 + pagecolor="#ffffff"
  23 + bordercolor="#666666"
  24 + borderopacity="1.0"
  25 + inkscape:pageopacity="0.0"
  26 + inkscape:pageshadow="2"
  27 + inkscape:zoom="0.49497475"
  28 + inkscape:cx="523.94744"
  29 + inkscape:cy="432.71593"
  30 + inkscape:document-units="px"
  31 + inkscape:current-layer="layer1"
  32 + showgrid="false"
  33 + units="in"
  34 + inkscape:window-width="1366"
  35 + inkscape:window-height="744"
  36 + inkscape:window-x="0"
  37 + inkscape:window-y="24"
  38 + inkscape:window-maximized="1" />
  39 + <metadata
  40 + id="metadata4000">
  41 + <rdf:RDF>
  42 + <cc:Work
  43 + rdf:about="">
  44 + <dc:format>image/svg+xml</dc:format>
  45 + <dc:type
  46 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  47 + <dc:title></dc:title>
  48 + </cc:Work>
  49 + </rdf:RDF>
  50 + </metadata>
  51 + <g
  52 + inkscape:label="Layer 1"
  53 + inkscape:groupmode="layer"
  54 + id="layer1"
  55 + transform="translate(0,27.64025)">
  56 + <rect
  57 + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
  58 + id="rect4119"
  59 + width="53.25"
  60 + height="35.499996"
  61 + x="300.22464"
  62 + y="341.57254" />
  63 + </g>
  64 +</svg>
42 eternal.py
... ... @@ -0,0 +1,42 @@
  1 +import serial
  2 +import subprocess
  3 +import time
  4 +
  5 +ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=0.25)
  6 +
  7 +nuclear_time = 3600 # nuclear timeout in seconds
  8 +nuke = 0
  9 +disabled_sites = '/var/banhammer.txt'
  10 +#reload_config = "squid3 -k reconfigure"
  11 +reload_config = "echo \"reconfigure\""
  12 +#Sites to block
  13 +banhammer = """^.*reddit.com
  14 +^.*news.ycombinator.com
  15 +^.*somethingawful.com
  16 +"""
  17 +
  18 +while(1):
  19 + line = ser.readline()
  20 + if(line.find("disable_procrastination") != -1):
  21 + myfile = open(disabled_sites, 'w')
  22 + myfile.write(banhammer)
  23 + myfile.close()
  24 + print "Disable"
  25 + subprocess.call(reload_config, shell=True)
  26 + if(line.find("enable_procrastination") != -1):
  27 + open(disabled_sites, 'w').close()
  28 + print "Enable"
  29 + subprocess.call(reload_config, shell=True)
  30 + if(line.find("boom") != -1):
  31 + myfile = open(disabled_sites, 'w')
  32 + myfile.write(banhammer)
  33 + myfile.close()
  34 + print "Nuclear"
  35 + subprocess.call(reload_config, shell=True)
  36 + nuke += nuclear_time
  37 + while nuke >= 0:
  38 + print nuke
  39 + ser.write(str(nuke))
  40 + ser.write('\n')
  41 + nuke -= 1
  42 + time.sleep(1)
277 eternalduino/eternalduino_ino.ino
... ... @@ -0,0 +1,277 @@
  1 +#include "pins_arduino.h"
  2 +#include <SoftwareSerial.h>
  3 +
  4 +volatile uint8_t *port_to_pcmask[] = {
  5 + &PCMSK0,
  6 + &PCMSK1,
  7 + &PCMSK2
  8 +};
  9 +
  10 +static int PCintMode[24];
  11 +
  12 +typedef void (*voidFuncPtr)(void);
  13 +
  14 +volatile static voidFuncPtr PCintFunc[24] = {
  15 + NULL };
  16 +
  17 +volatile static uint8_t PCintLast[3];
  18 +
  19 +/*
  20 + * attach an interrupt to a specific pin using pin change interrupts.
  21 + */
  22 + void PCattachInterrupt(uint8_t pin, void (*userFunc)(void), int mode) {
  23 + uint8_t bit = digitalPinToBitMask(pin);
  24 + uint8_t port = digitalPinToPort(pin);
  25 + uint8_t slot;
  26 + volatile uint8_t *pcmask;
  27 +
  28 + // map pin to PCIR register
  29 + if (port == NOT_A_PORT) {
  30 + return;
  31 + }
  32 + else {
  33 + port -= 2;
  34 + pcmask = port_to_pcmask[port];
  35 + }
  36 +
  37 +// -- Fix by Baziki. In the original sources it was a little bug, which cause analog ports to work incorrectly.
  38 + if (port == 1) {
  39 + slot = port * 8 + (pin - 14);
  40 + }
  41 + else {
  42 + slot = port * 8 + (pin % 8);
  43 + }
  44 +// --Fix end
  45 + PCintMode[slot] = mode;
  46 + PCintFunc[slot] = userFunc;
  47 + // set the mask
  48 + *pcmask |= bit;
  49 + // enable the interrupt
  50 + PCICR |= 0x01 << port;
  51 +}
  52 +
  53 +void PCdetachInterrupt(uint8_t pin) {
  54 + uint8_t bit = digitalPinToBitMask(pin);
  55 + uint8_t port = digitalPinToPort(pin);
  56 + volatile uint8_t *pcmask;
  57 +
  58 + // map pin to PCIR register
  59 + if (port == NOT_A_PORT) {
  60 + return;
  61 + }
  62 + else {
  63 + port -= 2;
  64 + pcmask = port_to_pcmask[port];
  65 + }
  66 +
  67 + // disable the mask.
  68 + *pcmask &= ~bit;
  69 + // if that's the last one, disable the interrupt.
  70 + if (*pcmask == 0) {
  71 + PCICR &= ~(0x01 << port);
  72 + }
  73 +}
  74 +
  75 +// common code for isr handler. "port" is the PCINT number.
  76 +// there isn't really a good way to back-map ports and masks to pins.
  77 +static void PCint(uint8_t port) {
  78 + uint8_t bit;
  79 + uint8_t curr;
  80 + uint8_t mask;
  81 + uint8_t pin;
  82 +
  83 + // get the pin states for the indicated port.
  84 + curr = *portInputRegister(port+2);
  85 + mask = curr ^ PCintLast[port];
  86 + PCintLast[port] = curr;
  87 + // mask is pins that have changed. screen out non pcint pins.
  88 + if ((mask &= *port_to_pcmask[port]) == 0) {
  89 + return;
  90 + }
  91 + // mask is pcint pins that have changed.
  92 + for (uint8_t i=0; i < 8; i++) {
  93 + bit = 0x01 << i;
  94 + if (bit & mask) {
  95 + pin = port * 8 + i;
  96 + // Trigger interrupt if mode is CHANGE, or if mode is RISING and
  97 + // the bit is currently high, or if mode is FALLING and bit is low.
  98 + if ((PCintMode[pin] == CHANGE
  99 + || ((PCintMode[pin] == RISING) && (curr & bit))
  100 + || ((PCintMode[pin] == FALLING) && !(curr & bit)))
  101 + && (PCintFunc[pin] != NULL)) {
  102 + PCintFunc[pin]();
  103 + }
  104 + }
  105 + }
  106 +}
  107 +
  108 +//I've removed all the other interrupt vectors here, so they can be used by softserial
  109 +SIGNAL(PCINT2_vect) {
  110 + PCint(2);
  111 +}
  112 +
  113 +SoftwareSerial sevenSeg(11, 10);
  114 +boolean button_toggle = false;
  115 +boolean buzzer_on = false;
  116 +boolean nuclear_mode = false;
  117 +
  118 +//Interrupt for key switch
  119 +void little_key_switch(void) {
  120 + buzzer_on = !buzzer_on;
  121 + delay(100); //debounce
  122 +}
  123 +
  124 +
  125 +void big_red_button(void) {
  126 + button_toggle = !button_toggle;
  127 + if(!buzzer_on && !nuclear_mode)
  128 + {
  129 + if(button_toggle)
  130 + {
  131 + Serial.println("disable_procrastination"); //Python script activates here
  132 + } else {
  133 + Serial.println("enable_procrastination");
  134 + }
  135 +
  136 + } else {
  137 + Serial.println("boom");
  138 + sevenSeg.print("OHNO");
  139 + nuclear_mode=true;
  140 + buzzer_on = false;
  141 + delay(3000); //keep display for ghosting coming out of the interrupt
  142 + }
  143 + delay(50); //debounce
  144 +}
  145 +
  146 +
  147 +
  148 +void displayNumber(int number)
  149 +{
  150 + int digits[4] = { (int)'x', (int)'x', (int)'x', (int)'x' };
  151 + for(int i = 0; i < 4; i++)
  152 + {
  153 + digits[i] = number % 10;
  154 + number = number / 10;
  155 + if(number == 0)
  156 + {
  157 + break;
  158 + }
  159 + }
  160 + sevenSeg.print("v");
  161 + sevenSeg.print(digits[3]);
  162 + sevenSeg.print(digits[2]);
  163 + sevenSeg.print(digits[1]);
  164 + sevenSeg.print(digits[0]);
  165 +
  166 +}
  167 +
  168 +String inputString = "";
  169 +boolean stringComplete = false;
  170 +
  171 +void setup()
  172 +{
  173 + Serial.begin(9600);
  174 + inputString.reserve(50);
  175 + Serial.println("#Stop Online Productivity Aversion");
  176 + sevenSeg.begin(9600);
  177 + pinMode(4, INPUT);
  178 + pinMode(5, INPUT);
  179 + pinMode(9, OUTPUT);
  180 + pinMode(10, OUTPUT);
  181 + delay(3000);
  182 + PCattachInterrupt(4, little_key_switch, CHANGE);
  183 + PCattachInterrupt(5, big_red_button, FALLING);
  184 + sevenSeg.print("v");
  185 + sevenSeg.print("SOPA");
  186 +}
  187 +
  188 +//read string from python script
  189 +void serialEvent()
  190 +{
  191 + while(Serial.available()) {
  192 + char inChar = (char)Serial.read();
  193 + inputString += inChar;
  194 + if(inChar == '\n')
  195 + {
  196 + stringComplete = true;
  197 + }
  198 + }
  199 +}
  200 +
  201 +//convert string in seconds to time like this: HH:MM or MM:SS
  202 +//return number of seconds
  203 +//side effect: display output
  204 +int stringToTime(String time)
  205 +{
  206 + char buf[10];
  207 + time.toCharArray(buf, 10);
  208 + int nuketime = atoi(buf);
  209 + int rv = nuketime;
  210 + int smh[3] = { 0, 0, 0 };
  211 + for(int i = 0; i < 3; i++)
  212 + {
  213 + smh[i] = nuketime % 60;
  214 + nuketime = nuketime / 60;
  215 + }
  216 +
  217 + char left[3];
  218 + char right[3];
  219 + char combined[5];
  220 + if(smh[2] == 0)
  221 + {
  222 + sprintf(right, "%02d", smh[0]);
  223 + sprintf(left, "%02d", smh[1]);
  224 + } else {
  225 + sprintf(right, "%02d", smh[1]);
  226 + sprintf(left, "%02d", smh[2]);
  227 + }
  228 + sprintf(combined, "%s%s", left, right);
  229 +
  230 + sevenSeg.print("v");
  231 + sevenSeg.write(0x77);
  232 + sevenSeg.write(0x10);
  233 + sevenSeg.print(combined[0]);
  234 + sevenSeg.print(combined[1]);
  235 + sevenSeg.print(combined[2]);
  236 + sevenSeg.print(combined[3]);
  237 +
  238 + return rv;
  239 +
  240 +}
  241 +
  242 +void loop() {
  243 + if(nuclear_mode)
  244 + {
  245 + if(stringComplete)
  246 + {
  247 + if(stringToTime(inputString) == 0)
  248 + {
  249 + sevenSeg.write(0x77);
  250 + sevenSeg.write((uint8_t)
  251 +
  252 + 0x00);
  253 + nuclear_mode = false;
  254 +
  255 + }
  256 + inputString = "";
  257 + stringComplete = false;
  258 + }
  259 + } else {
  260 + if(buzzer_on)
  261 + {
  262 + analogWrite(9, 128);
  263 + sevenSeg.print("xxxx");
  264 + delay(500);
  265 + analogWrite(9, LOW);
  266 + sevenSeg.print("bang");
  267 + delay(500);
  268 + } else {
  269 + if(button_toggle)
  270 + {
  271 + sevenSeg.print("NOPA");
  272 + } else {
  273 + sevenSeg.print("SOPA");
  274 + }
  275 + }
  276 + }
  277 +}

0 comments on commit 5be3c5e

Please sign in to comment.
Something went wrong with that request. Please try again.