diff --git a/car.cgi.go b/car.cgi.go new file mode 100644 index 0000000..f157341 --- /dev/null +++ b/car.cgi.go @@ -0,0 +1,66 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "net/http/cgi" + "os" + "github.com/jsgoecke/tesla" + "github.com/coduno/netrc" +) + +const authtok = "~!Jf5!uYFxhK" +const clientId = "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384" +const clientSec = "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3" + +type Handler struct { + cgi.Handler +} + +func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.FormValue("auth") != authtok { + w.Header().Set("Content-Type", "text/plain") + fmt.Fprintln(w, "NO: Invalid authtok") + return + } + + os.Setenv("HOME", "/home/neale") + n, _ := netrc.Parse() + secrets := n["gitlab.com"] // Requiring a password is such bullshit. + + auth := tesla.Auth{ + ClientID: clientId, + ClientSecret: clientSec, + Email: secrets.Login, + Password: secrets.Password, + } + cli, err := tesla.NewClient(&auth) + if err != nil { + w.Header().Set("Content-Type", "text/plain") + fmt.Fprintln(w, err) + return + } + + vehicles, err := cli.Vehicles() + if err != nil { + w.Header().Set("Content-Type", "text/plain") + fmt.Fprintln(w, err) + return + } + + vehicle := vehicles[0] + w.Header().Set("Content-Type", "text/plain") + fmt.Fprintln(w, "OK") + fmt.Fprintln(w, vehicle.StartAirConditioning()) +} + +func main() { + log.SetOutput(os.Stdout) + log.SetFlags(0) + log.SetPrefix("Status: 500 CGI Go Boom\nContent-type: text/plain\n\nERROR: ") + h := Handler{} + if err := cgi.Serve(h); err != nil { + log.Fatal(err) + } +} diff --git a/install b/install index f107d9c..7dba460 100755 --- a/install +++ b/install @@ -17,64 +17,75 @@ older () { html () { - target=$DESTDIR/${1%mdwn}html - if older $target $1 tmpl/*; then - echo "HTML $1" - mkdir -p $(dirname $target) - ./tmpl/mdwntohtml < $1 > $target - fi + target=$DESTDIR/${1%mdwn}html + if older $target $1 tmpl/*; then + echo "HTML $1" + mkdir -p $(dirname $target) + ./tmpl/mdwntohtml < $1 > $target + fi } copy () { - target=$DESTDIR/$1 - if older $target $1; then - echo "COPY $1" - mkdir -p $(dirname $target) - cp $1 $target - fi + target=$DESTDIR/$1 + if older $target $1; then + echo "COPY $1" + mkdir -p $(dirname $target) + cp $1 $target + fi } cc () { - target=$DESTDIR/${1%.c} - if older $target $1; then - echo "CC $1" - gcc -o $target $1 - fi + target=$DESTDIR/${1%.c} + if older $target $1; then + echo "CC $1" + gcc -o $target $1 + fi } gc () { - target=$DESTDIR/${1%.go} - if older $target $1; then - echo "GO $1" - go build -o $target $1 - fi + target=$DESTDIR/${1%.go} + if older $target $1; then + echo "GO $1" + go build -o $target $1 + fi +} + +setuid () { + target=$DESTDIR/${1%.*} + echo "SETUID $target" + chmod u+s $target } install () { - fd=$(dirname $fn) - echo "SUBINSTALL $fd" - (cd $fd && ./install $DESTDIR/$fd) + fd=$(dirname $fn) + echo "SUBINSTALL $fd" + (cd $fd && ./install $DESTDIR/$fd) } git ls-files | while read fn; do - case "$fn" in + case "$fn" in .*|*/.*|*~|install) - ;; + true # Skip + ;; */install) - install $fn - ;; + install $fn + ;; + car.cgi.go) + gc $fn + setuid $fn + ;; *.mdwn) - html $fn - ;; + html $fn + ;; *.cgi.c) - cc $fn - ;; + cc $fn + ;; *.cgi.go) - gc $fn - ;; + gc $fn + ;; *) - copy $fn - ;; - esac + copy $fn + ;; + esac done diff --git a/misc/i-also-enjoy-wearing-kilts.mdwn b/misc/i-also-enjoy-wearing-kilts.mdwn new file mode 100644 index 0000000..ab3e6ac --- /dev/null +++ b/misc/i-also-enjoy-wearing-kilts.mdwn @@ -0,0 +1,11 @@ +Title: I Also Enjoy Wearing Kilts + +*This was published as a [letter to the Editor of the Daily Post](http://www.ladailypost.com/content/letter-editor-i-also-enjoy-wearing-kilts)* + +September 28, 2016 + +I enjoyed seeing the article "Los Alamos County Council Candidate Models Kilts" - click [here](http://www.ladailypost.com/content/los-alamos-county-council-candidate-models-kilts). + +I've been wearing kilts to work several days a week since August, and find them practical and comfortable. I get positive comments every time I wear one! + +Congratulations to Jaret McDonald on getting the modeling gig! diff --git a/misc/twatch-config/fonts.html b/misc/twatch-config/fonts.html index 88383e1..d69d3a2 100644 --- a/misc/twatch-config/fonts.html +++ b/misc/twatch-config/fonts.html @@ -20,8 +20,9 @@ - - + + + diff --git a/misc/twatch-config/twatch.js b/misc/twatch-config/twatch.js index 462b842..7d96df4 100644 --- a/misc/twatch-config/twatch.js +++ b/misc/twatch-config/twatch.js @@ -30,7 +30,7 @@ function submit() { } else if (t == "text") { v = Number(input.value); } else if (t == "select-one") { - v = Number(input.value); + v = input.value; } else { console.log("Unknown type: " + t); continue; diff --git a/papers/reply-to-still-harmful.mdwn b/papers/reply-to-still-harmful.mdwn index 5df078b..056ab47 100644 --- a/papers/reply-to-still-harmful.mdwn +++ b/papers/reply-to-still-harmful.mdwn @@ -94,7 +94,7 @@ action send to the list and the list only, and provides a "reply to author" action that will always send to the message's author whether it's a list or not. "Reply to author" honors the `Reply-To` field. This is exactly the convenient behavior Simon claims to want in his -essay, and it can all be done using standard behavior. +"considered useful" essay, and it can all be done using standard behavior. Getting two copies of the same email diff --git a/src/xss.mdwn b/src/xss.mdwn index 20a5ee1..f59f8d9 100644 --- a/src/xss.mdwn +++ b/src/xss.mdwn @@ -91,7 +91,7 @@ download a [tarball of the latest commit](http://woozle.org/neale/g.cgi/x11/xss/snapshot/xss-master.tar.gz), or clone the git repository: - git clone http://woozle.org/~neale/projects/xss + git clone http://woozle.org/~neale/projects/x11/xss History