Code Monkey home page Code Monkey logo

secret-shipping's Introduction

Secret Shipping Signup Sheet

Did it in Python and sqlite3 out of stubborness.

Setup

  • Gotta create the sqlite3 file TODO: autogenerate by index.cgi if missing

    sqlite3 ss2024.db "CREATE TABLE IF NOT EXISTS signups
        (tstamp DATETIME, remote_addr, name, email, address, country,
        intro, foreignokay, moon);"
    chmod 666 ss2024.db
    

    and to do writes you gotta make the folder writable by the webserver

    chmod g+rwx .; sudo chgrp www-data .
    
  • Gotta set the start/end times. remember these will use the server clock, which may not be the your clock nor every participant's clock.

    OPEN_TIME = "2024-01-02 17:00"
    CLOSED_TIME = "2024-01-08 17:00"
    
  • the html output, especially forms, are all written into the index.cgi which is not great for customizing but it did the job for this event

  • Gotta tell nginx to launch .cgi programs, and not allow sqlite3 db downloads

    index index.html index.htm index.cgi ;
    location ~ \.cgi$ {
      include      snippets/fastcgi.conf ;
    }
    location ~ .*\.db {
      return 403;
    }
    

    I ain't gonna write fastcgi.conf here, you can figure it out.

Use

It's index.cgi, people just sign-up. They can sign up more than once but I have a limit of no more than 32 signups from the same IP address.

After the CLOSED_TIME pases, launch ./show_results.py and copy-paste into email messages to each person. Don't automate this part because it needs a human to verify each link in the chain.

TODO

  • What if someone signs up faking another person's name?
  • How to correctly merge multiple sign-ups by (legit) the same person?
  • How can a participant drop-out? I used delete from signups where name = 'Mozai'; for now.
  • Refine protection of the sqlite3 database, currently done in nginx config.

Image credits

  • check-em by Cpt.Nameless
  • nepeta-with-her-tablet by Zethrina
  • equius-at-attention by Luzerna

secret-shipping's People

Contributors

mozai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.