aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-10-05 14:30:43 -0700
committerChristine Dodrill <me@christine.website>2018-10-05 14:31:22 -0700
commita37fe34bc17f2f3d122da6b121ed83ef8ee7b0fa (patch)
treeac3be2cf3f091ec3cec4aa247f1b9cb264c1bee5 /tools
parent2c85a708989624df6bb9eca0a77ceeda8cf05f28 (diff)
downloadx-a37fe34bc17f2f3d122da6b121ed83ef8ee7b0fa.tar.xz
x-a37fe34bc17f2f3d122da6b121ed83ef8ee7b0fa.zip
automate xena/xperimental build
Diffstat (limited to 'tools')
-rw-r--r--tools/dokku/.gitignore1
-rw-r--r--tools/dokku/README.md55
-rw-r--r--tools/dokku/config.go11
-rw-r--r--tools/dokku/dokku.cfg.sample2
-rw-r--r--tools/dokku/main.go64
-rw-r--r--tools/graphirot/README.md3
-rw-r--r--tools/graphirot/main.go100
-rw-r--r--tools/graphirot/tree.svg198
-rw-r--r--tools/imagesize/.gitignore2
-rw-r--r--tools/imagesize/main.go147
-rw-r--r--tools/yk/main.go48
11 files changed, 0 insertions, 631 deletions
diff --git a/tools/dokku/.gitignore b/tools/dokku/.gitignore
deleted file mode 100644
index ae9366d..0000000
--- a/tools/dokku/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dokku
diff --git a/tools/dokku/README.md b/tools/dokku/README.md
deleted file mode 100644
index a017917..0000000
--- a/tools/dokku/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-Dokku
-=====
-
-This is a simple command line tool to interface with Dokku servers. This is
-a port of my shell extension
-[`dokku.zsh`](https://github.com/Xe/dotfiles/blob/master/.zsh/dokku.zsh) to
-a nice Go binary.
-
-This takes a configuration file for defining multiple servers:
-
-```ini
-[server "default"]
-user = dokku
-host = panel.apps.xeserv.us
-sshkey = /.ssh/id_rsa
-```
-
-By default it will imply that the SSH key is `~/.ssh/id_rsa` and that the
-username is `dokku`. By default the server named `default` will be used for
-command execution.
-
-TODO
-----
-
-- [ ] Allow interactive commands
-- [ ] Directly pipe stdin and stdout to the ssh connection
-
----
-
-```
-This is free and unencumbered software released into the public domain.
-
-Anyone is free to copy, modify, publish, use, compile, sell, or
-distribute this software, either in source code form or as a compiled
-binary, for any purpose, commercial or non-commercial, and by any
-means.
-
-In jurisdictions that recognize copyright laws, the author or authors
-of this software dedicate any and all copyright interest in the
-software to the public domain. We make this dedication for the benefit
-of the public at large and to the detriment of our heirs and
-successors. We intend this dedication to be an overt act of
-relinquishment in perpetuity of all present and future rights to this
-software under copyright law.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-For more information, please refer to <http://unlicense.org/>
-```
diff --git a/tools/dokku/config.go b/tools/dokku/config.go
deleted file mode 100644
index 74c5e0b..0000000
--- a/tools/dokku/config.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package main
-
-type Config struct {
- Server map[string]*Server
-}
-
-type Server struct {
- SSHKey string // if blank default key will be used.
- Host string // hostname of the dokku server
- User string // if blank username will be dokku
-}
diff --git a/tools/dokku/dokku.cfg.sample b/tools/dokku/dokku.cfg.sample
deleted file mode 100644
index b914ebe..0000000
--- a/tools/dokku/dokku.cfg.sample
+++ /dev/null
@@ -1,2 +0,0 @@
-[server "default"]
-host = panel.apps.xeserv.us
diff --git a/tools/dokku/main.go b/tools/dokku/main.go
deleted file mode 100644
index 796083d..0000000
--- a/tools/dokku/main.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package main // christine.website/go/tools/dokku
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
- "strings"
-
- "github.com/hypersleep/easyssh"
- gcfg "gopkg.in/gcfg.v1"
-)
-
-var (
- cfgPath = flag.String("cfg", "", "configuration path, default is ~/.dokku.cfg")
- serverName = flag.String("server", "default", "server to use out of dokku config")
-)
-
-func main() {
- flag.Parse()
-
- if *cfgPath == "" {
- *cfgPath = os.Getenv("HOME") + "/.dokku.cfg"
- }
-
- var cfg Config
- err := gcfg.ReadFileInto(&cfg, *cfgPath)
- if err != nil {
- log.Fatal(err)
- }
-
- var server *Server
- var ok bool
-
- if server, ok = cfg.Server[*serverName]; !ok {
- log.Fatalf("server %s not defined in configuration file %s", *serverName, *cfgPath)
- }
-
- if server.User == "" {
- server.User = "dokku"
- }
-
- if server.SSHKey == "" {
- server.SSHKey = "/.ssh/id_rsa"
- }
-
- ssh := &easyssh.MakeConfig{
- User: server.User,
- Server: server.Host,
- Key: server.SSHKey,
- }
-
- command := strings.Join(flag.Args(), " ")
-
- stdout, stderr, _, err := ssh.Run(command, 360)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Print(stdout)
- fmt.Println()
- fmt.Print(stderr)
- fmt.Println()
-}
diff --git a/tools/graphirot/README.md b/tools/graphirot/README.md
deleted file mode 100644
index beb7f7b..0000000
--- a/tools/graphirot/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# graphirot
-
-A really, really bad idea to find out what happens when you translate the tree of life to graphviz.
diff --git a/tools/graphirot/main.go b/tools/graphirot/main.go
deleted file mode 100644
index bf0964a..0000000
--- a/tools/graphirot/main.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/mzohreva/GoGraphviz/graphviz"
-)
-
-func main() {
- g := graphviz.Graph{}
-
- keter := g.AddNode("Keter")
- binah := g.AddNode("Binah")
- chokmah := g.AddNode("Chokmah")
- daat := g.AddNode("Da'at")
- gevurah := g.AddNode("Gevurah")
- hesed := g.AddNode("Hesed")
- tiferet := g.AddNode("Tilferet")
- hod := g.AddNode("Hod")
- netzah := g.AddNode("Netzah")
- yesod := g.AddNode("Yesod")
- malkhut := g.AddNode("Malkhut")
-
- g.NodeAttribute(keter, "group", "g1")
- g.NodeAttribute(binah, "group", "g2")
- g.NodeAttribute(chokmah, "group", "g2")
- g.NodeAttribute(daat, "group", "g3")
- g.NodeAttribute(gevurah, "group", "g4")
- g.NodeAttribute(hesed, "group", "g4")
- g.NodeAttribute(tiferet, "group", "g5")
- g.NodeAttribute(hod, "group", "g6")
- g.NodeAttribute(netzah, "group", "g6")
- g.NodeAttribute(yesod, "group", "g7")
- g.NodeAttribute(malkhut, "group", "g8")
-
- invisLink := func(a, b int) {
- e := g.AddEdge(a, b, "")
- g.EdgeAttribute(e, "style", "invis")
- }
- invisLink(daat, keter)
- invisLink(daat, binah)
- invisLink(daat, chokmah)
- invisLink(daat, tiferet)
-
- g.AddEdge(keter, binah, "")
- g.AddEdge(keter, chokmah, "")
- g.AddEdge(keter, tiferet, "")
-
- g.AddEdge(binah, chokmah, "")
- g.AddEdge(binah, keter, "")
- g.AddEdge(binah, gevurah, "")
- g.AddEdge(binah, tiferet, "")
- g.AddEdge(binah, hesed, "")
-
- g.AddEdge(chokmah, keter, "")
- g.AddEdge(chokmah, binah, "")
- g.AddEdge(chokmah, tiferet, "")
- g.AddEdge(chokmah, hesed, "")
-
- g.AddEdge(gevurah, binah, "")
- g.AddEdge(gevurah, chokmah, "")
- g.AddEdge(gevurah, hesed, "")
- g.AddEdge(gevurah, tiferet, "")
- g.AddEdge(gevurah, hod, "")
-
- g.AddEdge(hesed, chokmah, "")
- g.AddEdge(hesed, binah, "")
- g.AddEdge(hesed, gevurah, "")
- g.AddEdge(hesed, hod, "")
- g.AddEdge(hesed, netzah, "")
-
- g.AddEdge(tiferet, keter, "")
- g.AddEdge(tiferet, binah, "")
- g.AddEdge(tiferet, gevurah, "")
- g.AddEdge(tiferet, hesed, "")
- g.AddEdge(tiferet, hod, "")
- g.AddEdge(tiferet, netzah, "")
- g.AddEdge(tiferet, yesod, "")
-
- g.AddEdge(hod, gevurah, "")
- g.AddEdge(hod, tiferet, "")
- g.AddEdge(hod, netzah, "")
- g.AddEdge(hod, yesod, "")
-
- g.AddEdge(netzah, hesed, "")
- g.AddEdge(netzah, tiferet, "")
- g.AddEdge(netzah, hod, "")
- g.AddEdge(netzah, yesod, "")
-
- g.AddEdge(yesod, hod, "")
- g.AddEdge(yesod, tiferet, "")
- g.AddEdge(yesod, netzah, "")
- g.AddEdge(yesod, malkhut, "")
-
- g.MakeSameRank(binah, chokmah)
- g.MakeSameRank(gevurah, hesed)
- g.MakeSameRank(hod, netzah)
-
- g.GenerateDOT(os.Stdout)
-}
diff --git a/tools/graphirot/tree.svg b/tools/graphirot/tree.svg
deleted file mode 100644
index 9eeff5b..0000000
--- a/tools/graphirot/tree.svg
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<!-- Generated by graphviz version 2.40.1 (20161225.0304)
- -->
-<!-- Title: %0 Pages: 1 -->
-<svg width="296pt" height="548pt"
- viewBox="0.00 0.00 295.63 548.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 544)">
-<title>%0</title>
-<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-544 291.6333,-544 291.6333,4 -4,4"/>
-<!-- n0 -->
-<g id="node1" class="node">
-<title>n0</title>
-<ellipse fill="none" stroke="#000000" cx="183.2815" cy="-450" rx="32.4595" ry="18"/>
-<text text-anchor="middle" x="183.2815" y="-445.8" font-family="Times,serif" font-size="14.00" fill="#000000">Keter</text>
-</g>
-<!-- n1 -->
-<g id="node2" class="node">
-<title>n1</title>
-<ellipse fill="none" stroke="#000000" cx="102.2815" cy="-378" rx="34.2084" ry="18"/>
-<text text-anchor="middle" x="102.2815" y="-373.8" font-family="Times,serif" font-size="14.00" fill="#000000">Binah</text>
-</g>
-<!-- n0&#45;&#45;n1 -->
-<g id="edge5" class="edge">
-<title>n0&#45;&#45;n1</title>
-<path fill="none" stroke="#000000" d="M165.7057,-434.3771C152.1193,-422.3003 133.4008,-405.6616 119.823,-393.5924"/>
-</g>
-<!-- n2 -->
-<g id="node3" class="node">
-<title>n2</title>
-<ellipse fill="none" stroke="#000000" cx="203.2815" cy="-378" rx="48.6791" ry="18"/>
-<text text-anchor="middle" x="203.2815" y="-373.8" font-family="Times,serif" font-size="14.00" fill="#000000">Chokmah</text>
-</g>
-<!-- n0&#45;&#45;n2 -->
-<g id="edge6" class="edge">
-<title>n0&#45;&#45;n2</title>
-<path fill="none" stroke="#000000" d="M188.2253,-432.2022C191.2792,-421.2085 195.1867,-407.1413 198.2556,-396.0931"/>
-</g>
-<!-- n6 -->
-<g id="node7" class="node">
-<title>n6</title>
-<ellipse fill="none" stroke="#000000" cx="209.2815" cy="-234" rx="39.9799" ry="18"/>
-<text text-anchor="middle" x="209.2815" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">Tilferet</text>
-</g>
-<!-- n0&#45;&#45;n6 -->
-<g id="edge7" class="edge">
-<title>n0&#45;&#45;n6</title>
-<path fill="none" stroke="#000000" d="M209.8356,-439.5523C227.9361,-430.8627 250.5036,-416.5704 261.2815,-396 287.1914,-346.5491 246.5007,-281.816 223.4268,-251.3194"/>
-</g>
-<!-- n1&#45;&#45;n2 -->
-<g id="edge8" class="edge">
-<title>n1&#45;&#45;n2</title>
-<path fill="none" stroke="#000000" d="M136.6057,-378C142.5961,-378 148.5865,-378 154.5769,-378"/>
-</g>
-<!-- n4 -->
-<g id="node5" class="node">
-<title>n4</title>
-<ellipse fill="none" stroke="#000000" cx="44.2815" cy="-306" rx="44.0641" ry="18"/>
-<text text-anchor="middle" x="44.2815" y="-301.8" font-family="Times,serif" font-size="14.00" fill="#000000">Gevurah</text>
-</g>
-<!-- n1&#45;&#45;n4 -->
-<g id="edge9" class="edge">
-<title>n1&#45;&#45;n4</title>
-<path fill="none" stroke="#000000" d="M88.8294,-361.3008C79.5932,-349.8352 67.3697,-334.6612 58.0635,-323.1086"/>
-</g>
-<!-- n5 -->
-<g id="node6" class="node">
-<title>n5</title>
-<ellipse fill="none" stroke="#000000" cx="141.2815" cy="-306" rx="35.3315" ry="18"/>
-<text text-anchor="middle" x="141.2815" y="-301.8" font-family="Times,serif" font-size="14.00" fill="#000000">Hesed</text>
-</g>
-<!-- n1&#45;&#45;n5 -->
-<g id="edge11" class="edge">
-<title>n1&#45;&#45;n5</title>
-<path fill="none" stroke="#000000" d="M111.7223,-360.5708C117.809,-349.3339 125.6963,-334.7727 131.7925,-323.5182"/>
-</g>
-<!-- n1&#45;&#45;n6 -->
-<g id="edge10" class="edge">
-<title>n1&#45;&#45;n6</title>
-<path fill="none" stroke="#000000" d="M129.2611,-366.7881C147.6562,-357.8085 171.1549,-343.4853 185.2815,-324 200.848,-302.5286 206.3195,-271.6314 208.2418,-252.1971"/>
-</g>
-<!-- n2&#45;&#45;n5 -->
-<g id="edge13" class="edge">
-<title>n2&#45;&#45;n5</title>
-<path fill="none" stroke="#000000" d="M188.273,-360.5708C178.3817,-349.0841 165.4993,-334.1239 155.7248,-322.7729"/>
-</g>
-<!-- n2&#45;&#45;n6 -->
-<g id="edge12" class="edge">
-<title>n2&#45;&#45;n6</title>
-<path fill="none" stroke="#000000" d="M209.6763,-359.7647C212.9661,-349.4187 216.6257,-336.1474 218.2815,-324 221.6748,-299.1055 217.3109,-270.1729 213.5607,-251.9742"/>
-</g>
-<!-- n3 -->
-<g id="node4" class="node">
-<title>n3</title>
-<ellipse fill="none" stroke="#000000" cx="213.2815" cy="-522" rx="32.4595" ry="18"/>
-<text text-anchor="middle" x="213.2815" y="-517.8" font-family="Times,serif" font-size="14.00" fill="#000000">Da&#39;at</text>
-</g>
-<!-- n3&#45;&#45;n0 -->
-<!-- n3&#45;&#45;n1 -->
-<!-- n3&#45;&#45;n2 -->
-<!-- n3&#45;&#45;n6 -->
-<!-- n4&#45;&#45;n2 -->
-<g id="edge14" class="edge">
-<title>n4&#45;&#45;n2</title>
-<path fill="none" stroke="#000000" d="M73.8933,-319.4091C101.9034,-332.093 143.7792,-351.0556 172.2473,-363.9468"/>
-</g>
-<!-- n4&#45;&#45;n5 -->
-<g id="edge15" class="edge">
-<title>n4&#45;&#45;n5</title>
-<path fill="none" stroke="#000000" d="M88.6135,-306C94.3741,-306 100.1347,-306 105.8952,-306"/>
-</g>
-<!-- n4&#45;&#45;n6 -->
-<g id="edge16" class="edge">
-<title>n4&#45;&#45;n6</title>
-<path fill="none" stroke="#000000" d="M74.545,-292.7941C104.6885,-279.6406 150.6371,-259.5903 180.3164,-246.6393"/>
-</g>
-<!-- n7 -->
-<g id="node8" class="node">
-<title>n7</title>
-<ellipse fill="none" stroke="#000000" cx="81.2815" cy="-162" rx="27.8306" ry="18"/>
-<text text-anchor="middle" x="81.2815" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">Hod</text>
-</g>
-<!-- n4&#45;&#45;n7 -->
-<g id="edge17" class="edge">
-<title>n4&#45;&#45;n7</title>
-<path fill="none" stroke="#000000" d="M48.8928,-288.0535C55.9829,-260.4592 69.4871,-207.9026 76.6121,-180.1727"/>
-</g>
-<!-- n5&#45;&#45;n7 -->
-<g id="edge18" class="edge">
-<title>n5&#45;&#45;n7</title>
-<path fill="none" stroke="#000000" d="M133.9243,-288.3428C122.4087,-260.7053 100.2514,-207.5278 88.6989,-179.8017"/>
-</g>
-<!-- n8 -->
-<g id="node9" class="node">
-<title>n8</title>
-<ellipse fill="none" stroke="#000000" cx="165.2815" cy="-162" rx="38.2607" ry="18"/>
-<text text-anchor="middle" x="165.2815" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">Netzah</text>
-</g>
-<!-- n5&#45;&#45;n8 -->
-<g id="edge19" class="edge">
-<title>n5&#45;&#45;n8</title>
-<path fill="none" stroke="#000000" d="M144.2726,-288.0535C148.8716,-260.4592 157.6311,-207.9026 162.2527,-180.1727"/>
-</g>
-<!-- n6&#45;&#45;n5 -->
-<g id="edge20" class="edge">
-<title>n6&#45;&#45;n5</title>
-<path fill="none" stroke="#000000" d="M193.4404,-250.7729C182.3772,-262.4869 167.6836,-278.0448 156.7118,-289.6621"/>
-</g>
-<!-- n6&#45;&#45;n7 -->
-<g id="edge21" class="edge">
-<title>n6&#45;&#45;n7</title>
-<path fill="none" stroke="#000000" d="M183.9928,-219.7751C160.0955,-206.3329 124.6639,-186.4026 102.2837,-173.8137"/>
-</g>
-<!-- n6&#45;&#45;n8 -->
-<g id="edge22" class="edge">
-<title>n6&#45;&#45;n8</title>
-<path fill="none" stroke="#000000" d="M198.6303,-216.5708C191.7633,-205.3339 182.8648,-190.7727 175.9871,-179.5182"/>
-</g>
-<!-- n9 -->
-<g id="node10" class="node">
-<title>n9</title>
-<ellipse fill="none" stroke="#000000" cx="165.2815" cy="-90" rx="35.9154" ry="18"/>
-<text text-anchor="middle" x="165.2815" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">Yesod</text>
-</g>
-<!-- n6&#45;&#45;n9 -->
-<g id="edge23" class="edge">
-<title>n6&#45;&#45;n9</title>
-<path fill="none" stroke="#000000" d="M213.7884,-216.1022C217.5991,-197.46 221.1584,-167.7199 212.2815,-144 206.6184,-128.8677 194.5869,-115.179 184.1152,-105.3699"/>
-</g>
-<!-- n7&#45;&#45;n8 -->
-<g id="edge24" class="edge">
-<title>n7&#45;&#45;n8</title>
-<path fill="none" stroke="#000000" d="M109.1721,-162C115.0169,-162 120.8616,-162 126.7063,-162"/>
-</g>
-<!-- n7&#45;&#45;n9 -->
-<g id="edge25" class="edge">
-<title>n7&#45;&#45;n9</title>
-<path fill="none" stroke="#000000" d="M98.2802,-147.4297C112.4703,-135.2668 132.6468,-117.9726 147.1453,-105.5454"/>
-</g>
-<!-- n8&#45;&#45;n9 -->
-<g id="edge26" class="edge">
-<title>n8&#45;&#45;n9</title>
-<path fill="none" stroke="#000000" d="M165.2815,-143.8314C165.2815,-133 165.2815,-119.2876 165.2815,-108.4133"/>
-</g>
-<!-- n10 -->
-<g id="node11" class="node">
-<title>n10</title>
-<ellipse fill="none" stroke="#000000" cx="165.2815" cy="-18" rx="43.5214" ry="18"/>
-<text text-anchor="middle" x="165.2815" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">Malkhut</text>
-</g>
-<!-- n9&#45;&#45;n10 -->
-<g id="edge27" class="edge">
-<title>n9&#45;&#45;n10</title>
-<path fill="none" stroke="#000000" d="M165.2815,-71.8314C165.2815,-61 165.2815,-47.2876 165.2815,-36.4133"/>
-</g>
-</g>
-</svg>
diff --git a/tools/imagesize/.gitignore b/tools/imagesize/.gitignore
deleted file mode 100644
index 2f711bd..0000000
--- a/tools/imagesize/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-imagesize
-output
diff --git a/tools/imagesize/main.go b/tools/imagesize/main.go
deleted file mode 100644
index 21c7f7c..0000000
--- a/tools/imagesize/main.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "image"
- _ "image/gif"
- _ "image/jpeg"
- _ "image/png"
- "io"
- "log"
- "os"
- "path/filepath"
- "strings"
-)
-
-var (
- format = flag.String("format", "jpg", "Image format to prefer")
- outputDir = flag.String("output", "./output", "Where to write validated images to")
- where = flag.String("where", ".", "Directory to scan for unvalidated images")
- minWidth = flag.Int("minsize", 2559, "Minimum width") // Width of SP3 display
- debugFlag = flag.Bool("debug", false, "panic() on error?")
-)
-
-func main() {
- flag.Parse()
- log.Printf("Debug: %v", *debugFlag)
-
- // discard error value. XXX fix this?
- os.Mkdir(*outputDir, 0755)
-
- err := filepath.Walk(*where, validate)
- if err != nil {
- if *debugFlag {
- panic(err)
- } else {
- log.Fatal(err)
- }
- }
-}
-
-// validate takes a walked directory entry and sees if the image is big enough.
-func validate(path string, info os.FileInfo, err error) error {
- if info.IsDir() {
- return nil
- }
-
- fin, err := os.Open(path)
- if err != nil {
- return err
- }
- defer fin.Close()
-
- if *debugFlag {
- log.Println(path)
- }
-
- defer func() {
- if r := recover(); r != nil {
- log.Printf("%q: %v", path, r)
- }
- }()
-
- img, format, err := image.DecodeConfig(fin)
- if err != nil {
- return err
- }
-
- if img.Width > *minWidth {
- err = CopyFile(path, *outputDir+"/"+filepath.Base(strings.TrimSuffix(info.Name(), filepath.Ext(path))+"."+format))
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// CopyFile copies a file from src to dst. If src and dst files exist, and are
-// the same, then return success. Otherise, attempt to create a hard link
-// between the two files. If that fail, copy the file contents from src to dst.
-func CopyFile(src, dst string) (err error) {
- sfi, err := os.Stat(src)
- if err != nil {
- return
- }
-
- if !sfi.Mode().IsRegular() {
- // cannot copy non-regular files (e.g., directories,
- // symlinks, devices, etc.)
- return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String())
- }
-
- dfi, err := os.Stat(dst)
- if err != nil {
- if !os.IsNotExist(err) {
- return
- }
- } else {
- if !(dfi.Mode().IsRegular()) {
- return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String())
- }
-
- if os.SameFile(sfi, dfi) {
- return
- }
- }
- if err = os.Link(src, dst); err == nil {
- return
- }
-
- err = copyFileContents(src, dst)
- return
-
-}
-
-// copyFileContents copies the contents of the file named src to the file named
-// by dst. The file will be created if it does not already exist. If the
-// destination file exists, all it's contents will be replaced by the contents
-// of the source file.
-func copyFileContents(src, dst string) (err error) {
- in, err := os.Open(src)
- if err != nil {
- return
- }
- defer in.Close()
-
- out, err := os.Create(dst)
- if err != nil {
- return
- }
-
- defer func() {
- cerr := out.Close()
-
- if err == nil {
- err = cerr
- }
- }()
-
- if _, err = io.Copy(out, in); err != nil {
- return
- }
-
- err = out.Sync()
- return
-}
diff --git a/tools/yk/main.go b/tools/yk/main.go
deleted file mode 100644
index 56e8417..0000000
--- a/tools/yk/main.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package main
-
-import (
- "bufio"
- "fmt"
- "log"
- "os"
- "strings"
-
- "github.com/GeertJohan/yubigo"
- _ "github.com/joho/godotenv/autoload"
- "github.com/kr/pretty"
-)
-
-func main() {
- yubiAuth, err := yubigo.NewYubiAuth(os.Getenv("YUBIKEY_CLIENT_ID"), os.Getenv("YUBIKEY_SECRET_KEY"))
- if err != nil {
- log.Fatal(err)
- }
- _ = yubiAuth
-
- reader := bufio.NewReader(os.Stdin)
- fmt.Print("yk> ")
- text, err := reader.ReadString(byte('\n'))
- if err != nil {
- log.Fatal(err)
- }
-
- text = strings.TrimSpace(text)
-
- resp, _, err := yubiAuth.Verify(text)
- if err != nil {
- log.Fatal(err)
- }
-
- pretty.Println(resp)
-
- if !resp.IsValidOTP() {
- log.Fatal("invalid OTP")
- }
-
- prefix, _, err := yubigo.ParseOTP(text)
- if err != nil {
- log.Fatal(err)
- }
-
- log.Printf("uid: %s", prefix)
-}