From e36f755db2198a96e2b87781f5f5432fcee092dd Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Thu, 4 Oct 2018 19:01:51 -0700 Subject: fix build --- _tg/covfefe/commands/dice.go | 53 + _tg/covfefe/commands/printerfacts.go | 58 + _tg/covfefe/commands/spla2n.go | 104 + _tg/covfefe/main.go | 17 + _tg/meirl/.gitignore | 2 + _tg/meirl/gopreload.go | 9 + _tg/meirl/gops.go | 13 + _tg/meirl/main.go | 110 + _tg/pbot/main.go | 147 + _tg/pbot/puush.go | 93 + _tg/pbot/vendor/github.com/Xe/uuid/dce.go | 84 + _tg/pbot/vendor/github.com/Xe/uuid/doc.go | 8 + _tg/pbot/vendor/github.com/Xe/uuid/hash.go | 53 + _tg/pbot/vendor/github.com/Xe/uuid/node.go | 101 + _tg/pbot/vendor/github.com/Xe/uuid/time.go | 132 + _tg/pbot/vendor/github.com/Xe/uuid/util.go | 43 + _tg/pbot/vendor/github.com/Xe/uuid/uuid.go | 163 + _tg/pbot/vendor/github.com/Xe/uuid/version1.go | 41 + _tg/pbot/vendor/github.com/Xe/uuid/version4.go | 25 + _tg/pbot/vendor/github.com/fogleman/gg/bezier.go | 59 + _tg/pbot/vendor/github.com/fogleman/gg/context.go | 795 +++ _tg/pbot/vendor/github.com/fogleman/gg/gradient.go | 202 + _tg/pbot/vendor/github.com/fogleman/gg/matrix.go | 88 + _tg/pbot/vendor/github.com/fogleman/gg/path.go | 140 + _tg/pbot/vendor/github.com/fogleman/gg/pattern.go | 123 + _tg/pbot/vendor/github.com/fogleman/gg/point.go | 25 + _tg/pbot/vendor/github.com/fogleman/gg/util.go | 117 + _tg/pbot/vendor/github.com/fogleman/gg/wrap.go | 58 + .../fogleman/primitive/primitive/color.go | 44 + .../fogleman/primitive/primitive/core.go | 124 + .../fogleman/primitive/primitive/ellipse.go | 179 + .../fogleman/primitive/primitive/heatmap.go | 59 + .../github.com/fogleman/primitive/primitive/log.go | 23 + .../fogleman/primitive/primitive/model.go | 174 + .../fogleman/primitive/primitive/optimize.go | 75 + .../fogleman/primitive/primitive/polygon.go | 111 + .../fogleman/primitive/primitive/quadratic.go | 100 + .../fogleman/primitive/primitive/raster.go | 46 + .../fogleman/primitive/primitive/rectangle.go | 198 + .../fogleman/primitive/primitive/scanline.go | 29 + .../fogleman/primitive/primitive/shape.go | 25 + .../fogleman/primitive/primitive/state.go | 48 + .../fogleman/primitive/primitive/triangle.go | 171 + .../fogleman/primitive/primitive/util.go | 195 + .../fogleman/primitive/primitive/worker.go | 108 + .../github.com/golang/freetype/raster/geom.go | 245 + .../github.com/golang/freetype/raster/paint.go | 287 + .../github.com/golang/freetype/raster/raster.go | 601 ++ .../github.com/golang/freetype/raster/stroke.go | 483 ++ .../github.com/golang/freetype/truetype/face.go | 507 ++ .../github.com/golang/freetype/truetype/glyph.go | 522 ++ .../github.com/golang/freetype/truetype/hint.go | 1770 ++++++ .../github.com/golang/freetype/truetype/opcodes.go | 289 + .../golang/freetype/truetype/truetype.go | 653 ++ .../github.com/hullerob/go.farbfeld/farbfeld.go | 96 + .../github.com/joho/godotenv/autoload/autoload.go | 15 + .../vendor/github.com/joho/godotenv/godotenv.go | 247 + .../multipartstreamer/multipartstreamer.go | 101 + _tg/pbot/vendor/golang.org/x/image/bmp/reader.go | 199 + _tg/pbot/vendor/golang.org/x/image/bmp/writer.go | 166 + _tg/pbot/vendor/golang.org/x/image/draw/draw.go | 43 + _tg/pbot/vendor/golang.org/x/image/draw/gen.go | 1403 ++++ _tg/pbot/vendor/golang.org/x/image/draw/go1_8.go | 49 + _tg/pbot/vendor/golang.org/x/image/draw/go1_9.go | 57 + _tg/pbot/vendor/golang.org/x/image/draw/impl.go | 6668 ++++++++++++++++++++ _tg/pbot/vendor/golang.org/x/image/draw/scale.go | 527 ++ .../vendor/golang.org/x/image/draw/stdlib_test.go | 96 + .../golang.org/x/image/font/basicfont/basicfont.go | 126 + .../golang.org/x/image/font/basicfont/data.go | 1456 +++++ .../golang.org/x/image/font/basicfont/gen.go | 115 + _tg/pbot/vendor/golang.org/x/image/font/font.go | 359 ++ _tg/pbot/vendor/golang.org/x/image/math/f64/f64.go | 37 + .../vendor/golang.org/x/image/math/fixed/fixed.go | 410 ++ _tg/pbot/vendor/golang.org/x/image/riff/riff.go | 193 + _tg/pbot/vendor/golang.org/x/image/tiff/buffer.go | 69 + .../vendor/golang.org/x/image/tiff/compress.go | 58 + _tg/pbot/vendor/golang.org/x/image/tiff/consts.go | 133 + .../vendor/golang.org/x/image/tiff/lzw/reader.go | 272 + _tg/pbot/vendor/golang.org/x/image/tiff/reader.go | 681 ++ _tg/pbot/vendor/golang.org/x/image/tiff/writer.go | 438 ++ _tg/pbot/vendor/golang.org/x/image/vp8/decode.go | 403 ++ _tg/pbot/vendor/golang.org/x/image/vp8/filter.go | 273 + _tg/pbot/vendor/golang.org/x/image/vp8/idct.go | 98 + .../vendor/golang.org/x/image/vp8/partition.go | 129 + _tg/pbot/vendor/golang.org/x/image/vp8/pred.go | 201 + _tg/pbot/vendor/golang.org/x/image/vp8/predfunc.go | 553 ++ _tg/pbot/vendor/golang.org/x/image/vp8/quant.go | 98 + .../vendor/golang.org/x/image/vp8/reconstruct.go | 442 ++ _tg/pbot/vendor/golang.org/x/image/vp8/token.go | 381 ++ _tg/pbot/vendor/golang.org/x/image/vp8l/decode.go | 603 ++ _tg/pbot/vendor/golang.org/x/image/vp8l/huffman.go | 245 + .../vendor/golang.org/x/image/vp8l/transform.go | 299 + _tg/pbot/vendor/golang.org/x/image/webp/decode.go | 272 + _tg/pbot/vendor/golang.org/x/image/webp/webp.go | 30 + .../vendor/gopkg.in/telegram-bot-api.v4/bot.go | 694 ++ .../vendor/gopkg.in/telegram-bot-api.v4/configs.go | 789 +++ .../vendor/gopkg.in/telegram-bot-api.v4/helpers.go | 611 ++ .../vendor/gopkg.in/telegram-bot-api.v4/types.go | 627 ++ irc/bncadmin/vendor-log | 3 - irc/bncadmin/vendor/github.com/belak/irc/client.go | 109 - irc/bncadmin/vendor/github.com/belak/irc/conn.go | 79 - .../vendor/github.com/belak/irc/handler.go | 16 - irc/bncadmin/vendor/github.com/belak/irc/parser.go | 401 -- .../github.com/joho/godotenv/autoload/autoload.go | 15 - .../vendor/github.com/joho/godotenv/godotenv.go | 229 - irc/splatbot/.gitignore | 1 - irc/splatbot/Dockerfile | 6 - irc/splatbot/doc.go | 4 - irc/splatbot/handler.go | 53 - irc/splatbot/main.go | 45 - irc/splatbot/maps.go | 32 - irc/splatbot/stage.go | 12 - irc/trolling/smartbot/.gitignore | 2 - irc/trolling/smartbot/main.go | 87 - irc/trolling/smartbot/markov.go | 137 - mastodon/almarid/gops.go | 2 +- mastodon/almarid/main.go | 19 +- mastodon/furrybb/gopreload.go | 9 - mastodon/furrybb/gops.go | 2 +- mastodon/furrybb/main.go | 19 +- mastodon/furrybb/vendor-log | 13 - .../vendor/github.com/McKael/madon/account.go | 430 -- .../furrybb/vendor/github.com/McKael/madon/api.go | 137 - .../furrybb/vendor/github.com/McKael/madon/app.go | 96 - .../vendor/github.com/McKael/madon/favourites.go | 21 - .../vendor/github.com/McKael/madon/instance.go | 20 - .../vendor/github.com/McKael/madon/login.go | 88 - .../vendor/github.com/McKael/madon/madon.go | 36 - .../vendor/github.com/McKael/madon/media.go | 75 - .../github.com/McKael/madon/notifications.go | 47 - .../vendor/github.com/McKael/madon/report.go | 47 - .../vendor/github.com/McKael/madon/search.go | 30 - .../vendor/github.com/McKael/madon/status.go | 229 - .../vendor/github.com/McKael/madon/streams.go | 169 - .../vendor/github.com/McKael/madon/timelines.go | 46 - .../vendor/github.com/McKael/madon/types.go | 157 - .../furrybb/vendor/github.com/Xe/gopreload/doc.go | 7 - .../vendor/github.com/Xe/gopreload/preload.go | 26 - mastodon/furrybb/vendor/github.com/Xe/ln/filter.go | 66 - .../furrybb/vendor/github.com/Xe/ln/formatter.go | 110 - mastodon/furrybb/vendor/github.com/Xe/ln/logger.go | 141 - mastodon/furrybb/vendor/github.com/Xe/ln/stack.go | 44 - .../furrybb/vendor/github.com/caarlos0/env/env.go | 275 - .../vendor/github.com/google/gops/agent/agent.go | 237 - .../github.com/google/gops/internal/internal.go | 52 - .../vendor/github.com/google/gops/signal/signal.go | 35 - .../vendor/github.com/gorilla/websocket/client.go | 420 -- .../github.com/gorilla/websocket/compression.go | 85 - .../vendor/github.com/gorilla/websocket/conn.go | 1031 --- .../github.com/gorilla/websocket/conn_read.go | 18 - .../gorilla/websocket/conn_read_legacy.go | 21 - .../vendor/github.com/gorilla/websocket/doc.go | 173 - .../vendor/github.com/gorilla/websocket/json.go | 55 - .../vendor/github.com/gorilla/websocket/mask.go | 61 - .../vendor/github.com/gorilla/websocket/server.go | 292 - .../vendor/github.com/gorilla/websocket/util.go | 214 - .../github.com/joho/godotenv/autoload/autoload.go | 15 - .../vendor/github.com/joho/godotenv/godotenv.go | 235 - .../vendor/github.com/kardianos/osext/osext.go | 33 - .../github.com/kardianos/osext/osext_plan9.go | 20 - .../github.com/kardianos/osext/osext_procfs.go | 36 - .../github.com/kardianos/osext/osext_sysctl.go | 126 - .../github.com/kardianos/osext/osext_windows.go | 34 - .../furrybb/vendor/github.com/pkg/errors/errors.go | 269 - .../furrybb/vendor/github.com/pkg/errors/stack.go | 178 - .../vendor/github.com/sendgrid/rest/rest.go | 140 - mastodon/mkapp/main.go | 2 +- sdl/joydumpr/main.go | 36 - sdl/joypad/8bitdo_zero.go | 116 - sdl/joypad/direction_string.go | 16 - sdl/joypad/interface.go | 62 - sdl/zerohackr/main.go | 81 - tg/covfefe/commands/dice.go | 53 - tg/covfefe/commands/printerfacts.go | 58 - tg/covfefe/commands/spla2n.go | 104 - tg/covfefe/main.go | 17 - tg/meirl/.gitignore | 2 - tg/meirl/gopreload.go | 9 - tg/meirl/gops.go | 13 - tg/meirl/main.go | 110 - tg/pbot/main.go | 147 - tg/pbot/puush.go | 93 - tg/pbot/vendor/github.com/Xe/uuid/dce.go | 84 - tg/pbot/vendor/github.com/Xe/uuid/doc.go | 8 - tg/pbot/vendor/github.com/Xe/uuid/hash.go | 53 - tg/pbot/vendor/github.com/Xe/uuid/node.go | 101 - tg/pbot/vendor/github.com/Xe/uuid/time.go | 132 - tg/pbot/vendor/github.com/Xe/uuid/util.go | 43 - tg/pbot/vendor/github.com/Xe/uuid/uuid.go | 163 - tg/pbot/vendor/github.com/Xe/uuid/version1.go | 41 - tg/pbot/vendor/github.com/Xe/uuid/version4.go | 25 - tg/pbot/vendor/github.com/fogleman/gg/bezier.go | 59 - tg/pbot/vendor/github.com/fogleman/gg/context.go | 795 --- tg/pbot/vendor/github.com/fogleman/gg/gradient.go | 202 - tg/pbot/vendor/github.com/fogleman/gg/matrix.go | 88 - tg/pbot/vendor/github.com/fogleman/gg/path.go | 140 - tg/pbot/vendor/github.com/fogleman/gg/pattern.go | 123 - tg/pbot/vendor/github.com/fogleman/gg/point.go | 25 - tg/pbot/vendor/github.com/fogleman/gg/util.go | 117 - tg/pbot/vendor/github.com/fogleman/gg/wrap.go | 58 - .../fogleman/primitive/primitive/color.go | 44 - .../fogleman/primitive/primitive/core.go | 124 - .../fogleman/primitive/primitive/ellipse.go | 179 - .../fogleman/primitive/primitive/heatmap.go | 59 - .../github.com/fogleman/primitive/primitive/log.go | 23 - .../fogleman/primitive/primitive/model.go | 174 - .../fogleman/primitive/primitive/optimize.go | 75 - .../fogleman/primitive/primitive/polygon.go | 111 - .../fogleman/primitive/primitive/quadratic.go | 100 - .../fogleman/primitive/primitive/raster.go | 46 - .../fogleman/primitive/primitive/rectangle.go | 198 - .../fogleman/primitive/primitive/scanline.go | 29 - .../fogleman/primitive/primitive/shape.go | 25 - .../fogleman/primitive/primitive/state.go | 48 - .../fogleman/primitive/primitive/triangle.go | 171 - .../fogleman/primitive/primitive/util.go | 195 - .../fogleman/primitive/primitive/worker.go | 108 - .../github.com/golang/freetype/raster/geom.go | 245 - .../github.com/golang/freetype/raster/paint.go | 287 - .../github.com/golang/freetype/raster/raster.go | 601 -- .../github.com/golang/freetype/raster/stroke.go | 483 -- .../github.com/golang/freetype/truetype/face.go | 507 -- .../github.com/golang/freetype/truetype/glyph.go | 522 -- .../github.com/golang/freetype/truetype/hint.go | 1770 ------ .../github.com/golang/freetype/truetype/opcodes.go | 289 - .../golang/freetype/truetype/truetype.go | 653 -- .../github.com/hullerob/go.farbfeld/farbfeld.go | 96 - .../github.com/joho/godotenv/autoload/autoload.go | 15 - .../vendor/github.com/joho/godotenv/godotenv.go | 247 - .../multipartstreamer/multipartstreamer.go | 101 - tg/pbot/vendor/golang.org/x/image/bmp/reader.go | 199 - tg/pbot/vendor/golang.org/x/image/bmp/writer.go | 166 - tg/pbot/vendor/golang.org/x/image/draw/draw.go | 43 - tg/pbot/vendor/golang.org/x/image/draw/gen.go | 1403 ---- tg/pbot/vendor/golang.org/x/image/draw/go1_8.go | 49 - tg/pbot/vendor/golang.org/x/image/draw/go1_9.go | 57 - tg/pbot/vendor/golang.org/x/image/draw/impl.go | 6668 -------------------- tg/pbot/vendor/golang.org/x/image/draw/scale.go | 527 -- .../vendor/golang.org/x/image/draw/stdlib_test.go | 96 - .../golang.org/x/image/font/basicfont/basicfont.go | 126 - .../golang.org/x/image/font/basicfont/data.go | 1456 ----- .../golang.org/x/image/font/basicfont/gen.go | 115 - tg/pbot/vendor/golang.org/x/image/font/font.go | 359 -- tg/pbot/vendor/golang.org/x/image/math/f64/f64.go | 37 - .../vendor/golang.org/x/image/math/fixed/fixed.go | 410 -- tg/pbot/vendor/golang.org/x/image/riff/riff.go | 193 - tg/pbot/vendor/golang.org/x/image/tiff/buffer.go | 69 - tg/pbot/vendor/golang.org/x/image/tiff/compress.go | 58 - tg/pbot/vendor/golang.org/x/image/tiff/consts.go | 133 - .../vendor/golang.org/x/image/tiff/lzw/reader.go | 272 - tg/pbot/vendor/golang.org/x/image/tiff/reader.go | 681 -- tg/pbot/vendor/golang.org/x/image/tiff/writer.go | 438 -- tg/pbot/vendor/golang.org/x/image/vp8/decode.go | 403 -- tg/pbot/vendor/golang.org/x/image/vp8/filter.go | 273 - tg/pbot/vendor/golang.org/x/image/vp8/idct.go | 98 - tg/pbot/vendor/golang.org/x/image/vp8/partition.go | 129 - tg/pbot/vendor/golang.org/x/image/vp8/pred.go | 201 - tg/pbot/vendor/golang.org/x/image/vp8/predfunc.go | 553 -- tg/pbot/vendor/golang.org/x/image/vp8/quant.go | 98 - .../vendor/golang.org/x/image/vp8/reconstruct.go | 442 -- tg/pbot/vendor/golang.org/x/image/vp8/token.go | 381 -- tg/pbot/vendor/golang.org/x/image/vp8l/decode.go | 603 -- tg/pbot/vendor/golang.org/x/image/vp8l/huffman.go | 245 - .../vendor/golang.org/x/image/vp8l/transform.go | 299 - tg/pbot/vendor/golang.org/x/image/webp/decode.go | 272 - tg/pbot/vendor/golang.org/x/image/webp/webp.go | 30 - tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/bot.go | 694 -- .../vendor/gopkg.in/telegram-bot-api.v4/configs.go | 789 --- .../vendor/gopkg.in/telegram-bot-api.v4/helpers.go | 611 -- .../vendor/gopkg.in/telegram-bot-api.v4/types.go | 627 -- version/go1.11.1/main.go | 24 + version/go1.11/main.go | 24 + version/go1.8.typealias/main.go | 24 - 273 files changed, 30764 insertions(+), 38375 deletions(-) create mode 100644 _tg/covfefe/commands/dice.go create mode 100644 _tg/covfefe/commands/printerfacts.go create mode 100644 _tg/covfefe/commands/spla2n.go create mode 100644 _tg/covfefe/main.go create mode 100644 _tg/meirl/.gitignore create mode 100644 _tg/meirl/gopreload.go create mode 100644 _tg/meirl/gops.go create mode 100644 _tg/meirl/main.go create mode 100644 _tg/pbot/main.go create mode 100644 _tg/pbot/puush.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/dce.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/doc.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/hash.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/node.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/time.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/util.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/uuid.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/version1.go create mode 100644 _tg/pbot/vendor/github.com/Xe/uuid/version4.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/bezier.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/context.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/gradient.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/matrix.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/path.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/pattern.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/point.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/util.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/gg/wrap.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/color.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/core.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/ellipse.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/heatmap.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/log.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/model.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/optimize.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/polygon.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/quadratic.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/raster.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/rectangle.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/scanline.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/shape.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/state.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/triangle.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/util.go create mode 100644 _tg/pbot/vendor/github.com/fogleman/primitive/primitive/worker.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/raster/geom.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/raster/paint.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/raster/raster.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/raster/stroke.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/truetype/face.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/truetype/glyph.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/truetype/hint.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/truetype/opcodes.go create mode 100644 _tg/pbot/vendor/github.com/golang/freetype/truetype/truetype.go create mode 100644 _tg/pbot/vendor/github.com/hullerob/go.farbfeld/farbfeld.go create mode 100644 _tg/pbot/vendor/github.com/joho/godotenv/autoload/autoload.go create mode 100644 _tg/pbot/vendor/github.com/joho/godotenv/godotenv.go create mode 100644 _tg/pbot/vendor/github.com/technoweenie/multipartstreamer/multipartstreamer.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/bmp/reader.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/bmp/writer.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/draw.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/gen.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/go1_8.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/go1_9.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/impl.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/scale.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/draw/stdlib_test.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/font/basicfont/basicfont.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/font/basicfont/data.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/font/basicfont/gen.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/font/font.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/math/f64/f64.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/math/fixed/fixed.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/riff/riff.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/buffer.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/compress.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/consts.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/lzw/reader.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/reader.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/tiff/writer.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/decode.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/filter.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/idct.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/partition.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/pred.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/predfunc.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/quant.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/reconstruct.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8/token.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8l/decode.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8l/huffman.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/vp8l/transform.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/webp/decode.go create mode 100644 _tg/pbot/vendor/golang.org/x/image/webp/webp.go create mode 100644 _tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/bot.go create mode 100644 _tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/configs.go create mode 100644 _tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/helpers.go create mode 100644 _tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/types.go delete mode 100644 irc/bncadmin/vendor-log delete mode 100644 irc/bncadmin/vendor/github.com/belak/irc/client.go delete mode 100644 irc/bncadmin/vendor/github.com/belak/irc/conn.go delete mode 100644 irc/bncadmin/vendor/github.com/belak/irc/handler.go delete mode 100644 irc/bncadmin/vendor/github.com/belak/irc/parser.go delete mode 100644 irc/bncadmin/vendor/github.com/joho/godotenv/autoload/autoload.go delete mode 100644 irc/bncadmin/vendor/github.com/joho/godotenv/godotenv.go delete mode 100644 irc/splatbot/.gitignore delete mode 100644 irc/splatbot/Dockerfile delete mode 100644 irc/splatbot/doc.go delete mode 100644 irc/splatbot/handler.go delete mode 100644 irc/splatbot/main.go delete mode 100644 irc/splatbot/maps.go delete mode 100644 irc/splatbot/stage.go delete mode 100644 irc/trolling/smartbot/.gitignore delete mode 100644 irc/trolling/smartbot/main.go delete mode 100644 irc/trolling/smartbot/markov.go delete mode 100644 mastodon/furrybb/gopreload.go delete mode 100644 mastodon/furrybb/vendor-log delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/account.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/api.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/app.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/favourites.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/instance.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/login.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/madon.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/media.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/notifications.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/report.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/search.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/status.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/streams.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/timelines.go delete mode 100644 mastodon/furrybb/vendor/github.com/McKael/madon/types.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/gopreload/doc.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/gopreload/preload.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/ln/filter.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/ln/formatter.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/ln/logger.go delete mode 100644 mastodon/furrybb/vendor/github.com/Xe/ln/stack.go delete mode 100644 mastodon/furrybb/vendor/github.com/caarlos0/env/env.go delete mode 100644 mastodon/furrybb/vendor/github.com/google/gops/agent/agent.go delete mode 100644 mastodon/furrybb/vendor/github.com/google/gops/internal/internal.go delete mode 100644 mastodon/furrybb/vendor/github.com/google/gops/signal/signal.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/client.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/compression.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/conn.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/conn_read.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/conn_read_legacy.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/doc.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/json.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/mask.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/server.go delete mode 100644 mastodon/furrybb/vendor/github.com/gorilla/websocket/util.go delete mode 100644 mastodon/furrybb/vendor/github.com/joho/godotenv/autoload/autoload.go delete mode 100644 mastodon/furrybb/vendor/github.com/joho/godotenv/godotenv.go delete mode 100644 mastodon/furrybb/vendor/github.com/kardianos/osext/osext.go delete mode 100644 mastodon/furrybb/vendor/github.com/kardianos/osext/osext_plan9.go delete mode 100644 mastodon/furrybb/vendor/github.com/kardianos/osext/osext_procfs.go delete mode 100644 mastodon/furrybb/vendor/github.com/kardianos/osext/osext_sysctl.go delete mode 100644 mastodon/furrybb/vendor/github.com/kardianos/osext/osext_windows.go delete mode 100644 mastodon/furrybb/vendor/github.com/pkg/errors/errors.go delete mode 100644 mastodon/furrybb/vendor/github.com/pkg/errors/stack.go delete mode 100644 mastodon/furrybb/vendor/github.com/sendgrid/rest/rest.go delete mode 100644 sdl/joydumpr/main.go delete mode 100644 sdl/joypad/8bitdo_zero.go delete mode 100644 sdl/joypad/direction_string.go delete mode 100644 sdl/joypad/interface.go delete mode 100644 sdl/zerohackr/main.go delete mode 100644 tg/covfefe/commands/dice.go delete mode 100644 tg/covfefe/commands/printerfacts.go delete mode 100644 tg/covfefe/commands/spla2n.go delete mode 100644 tg/covfefe/main.go delete mode 100644 tg/meirl/.gitignore delete mode 100644 tg/meirl/gopreload.go delete mode 100644 tg/meirl/gops.go delete mode 100644 tg/meirl/main.go delete mode 100644 tg/pbot/main.go delete mode 100644 tg/pbot/puush.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/dce.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/doc.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/hash.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/node.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/time.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/util.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/uuid.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/version1.go delete mode 100644 tg/pbot/vendor/github.com/Xe/uuid/version4.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/bezier.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/context.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/gradient.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/matrix.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/path.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/pattern.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/point.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/util.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/gg/wrap.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/color.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/core.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/ellipse.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/heatmap.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/log.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/model.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/optimize.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/polygon.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/quadratic.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/raster.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/rectangle.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/scanline.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/shape.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/state.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/triangle.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/util.go delete mode 100644 tg/pbot/vendor/github.com/fogleman/primitive/primitive/worker.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/raster/geom.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/raster/paint.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/raster/raster.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/raster/stroke.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/truetype/face.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/truetype/glyph.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/truetype/hint.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/truetype/opcodes.go delete mode 100644 tg/pbot/vendor/github.com/golang/freetype/truetype/truetype.go delete mode 100644 tg/pbot/vendor/github.com/hullerob/go.farbfeld/farbfeld.go delete mode 100644 tg/pbot/vendor/github.com/joho/godotenv/autoload/autoload.go delete mode 100644 tg/pbot/vendor/github.com/joho/godotenv/godotenv.go delete mode 100644 tg/pbot/vendor/github.com/technoweenie/multipartstreamer/multipartstreamer.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/bmp/reader.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/bmp/writer.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/draw.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/gen.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/go1_8.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/go1_9.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/impl.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/scale.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/draw/stdlib_test.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/font/basicfont/basicfont.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/font/basicfont/data.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/font/basicfont/gen.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/font/font.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/math/f64/f64.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/math/fixed/fixed.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/riff/riff.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/buffer.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/compress.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/consts.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/lzw/reader.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/reader.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/tiff/writer.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/decode.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/filter.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/idct.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/partition.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/pred.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/predfunc.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/quant.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/reconstruct.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8/token.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8l/decode.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8l/huffman.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/vp8l/transform.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/webp/decode.go delete mode 100644 tg/pbot/vendor/golang.org/x/image/webp/webp.go delete mode 100644 tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/bot.go delete mode 100644 tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/configs.go delete mode 100644 tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/helpers.go delete mode 100644 tg/pbot/vendor/gopkg.in/telegram-bot-api.v4/types.go create mode 100644 version/go1.11.1/main.go create mode 100644 version/go1.11/main.go delete mode 100644 version/go1.8.typealias/main.go diff --git a/_tg/covfefe/commands/dice.go b/_tg/covfefe/commands/dice.go new file mode 100644 index 0000000..3572d6d --- /dev/null +++ b/_tg/covfefe/commands/dice.go @@ -0,0 +1,53 @@ +package commands + +import ( + "math/rand" + "strings" + "time" + + "github.com/justinian/dice" + "github.com/syfaro/finch" + "gopkg.in/telegram-bot-api.v4" +) + +func init() { + finch.RegisterCommand(&diceCommand{}) + rand.Seed(time.Now().Unix()) +} + +type diceCommand struct { + finch.CommandBase +} + +func (cmd *diceCommand) Help() finch.Help { + return finch.Help{ + Name: "Dice", + Description: "Standard: xdy[[k|d][h|l]z][+/-c] - rolls and sums x y-sided dice, keeping or dropping the lowest or highest z dice and optionally adding or subtracting c.", + Example: "/dice@@ 4d6kh3+4", + Botfather: [][]string{ + []string{"dice", "4d20, etc"}, + }, + } +} + +func (cmd *diceCommand) ShouldExecute(message tgbotapi.Message) bool { + return finch.SimpleCommand("dice", message.Text) +} + +func (cmd *diceCommand) Execute(message tgbotapi.Message) error { + parv := strings.Fields(message.CommandArguments()) + + if len(parv) != 1 { + msg := tgbotapi.NewMessage(message.Chat.ID, "Try something like 4d20") + return cmd.Finch.SendMessage(msg) + } + + text, _, err := dice.Roll(parv[0]) + if err != nil { + return err + } + + msg := tgbotapi.NewMessage(message.Chat.ID, text.String()) + + return cmd.Finch.SendMessage(msg) +} diff --git a/_tg/covfefe/commands/printerfacts.go b/_tg/covfefe/commands/printerfacts.go new file mode 100644 index 0000000..7bfb238 --- /dev/null +++ b/_tg/covfefe/commands/printerfacts.go @@ -0,0 +1,58 @@ +package commands + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + + "github.com/syfaro/finch" + "gopkg.in/telegram-bot-api.v4" +) + +func init() { + finch.RegisterCommand(&printerfactCommand{}) +} + +type printerfactCommand struct { + finch.CommandBase +} + +func (cmd *printerfactCommand) Help() finch.Help { + return finch.Help{ + Name: "Printerfact", + Description: "Displays printerfactrmation about the currently requesting user", + Example: "/printerfact@@", + Botfather: [][]string{ + []string{"printerfact", "Printerfactrmation about the current user"}, + }, + } +} + +func (cmd *printerfactCommand) ShouldExecute(message tgbotapi.Message) bool { + return finch.SimpleCommand("printerfact", message.Text) +} + +func (cmd *printerfactCommand) Execute(message tgbotapi.Message) error { + resp, err := http.Get("http://xena.stdlib.com/printerfacts") + if err != nil { + panic(err) + } + + factStruct := &struct { + Facts []string `json:"facts"` + }{} + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + panic(err) + } + + json.Unmarshal(body, factStruct) + + text := fmt.Sprintf("%s", factStruct.Facts[0]) + + msg := tgbotapi.NewMessage(message.Chat.ID, text) + + return cmd.Finch.SendMessage(msg) +} diff --git a/_tg/covfefe/commands/spla2n.go b/_tg/covfefe/commands/spla2n.go new file mode 100644 index 0000000..8cfaeeb --- /dev/null +++ b/_tg/covfefe/commands/spla2n.go @@ -0,0 +1,104 @@ +package commands + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "strings" + "time" + + "github.com/syfaro/finch" + "gopkg.in/telegram-bot-api.v4" +) + +func init() { + finch.RegisterCommand(&splattusCommand{}) +} + +type splattusCommand struct { + finch.CommandBase +} + +func (cmd *splattusCommand) Help() finch.Help { + return finch.Help{ + Name: "Splattus", + Description: "Displays splatoon 2 status", + Example: "/splattus@@", + Botfather: [][]string{ + []string{"splattus", "Splatoon 2 map rotations"}, + }, + } +} + +func (cmd *splattusCommand) ShouldExecute(message tgbotapi.Message) bool { + return finch.SimpleCommand("splattus", message.Text) +} + +func (cmd *splattusCommand) Execute(message tgbotapi.Message) error { + resp, err := http.Get("https://splatoon.ink/schedule2") + if err != nil { + panic(err) + } + + st := &splattus{} + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + panic(err) + } + + json.Unmarshal(body, st) + + modeInfo := []string{st.Modes.Regular[1].String(), st.Modes.Gachi[1].String(), st.Modes.League[1].String()} + text := strings.Join(modeInfo, "\n") + + msg := tgbotapi.NewMessage(message.Chat.ID, text) + + return cmd.Finch.SendMessage(msg) +} + +type splatoonMode struct { + StartTime int64 `json:"startTime"` + EndTime int64 `json:"endTime"` + Maps []string `json:"maps"` + Rule splatoonRule `json:"rule"` + Mode splatoonGameMode `json:"mode"` +} + +func (sm splatoonMode) String() string { + maps := strings.Join(sm.Maps, ", ") + end := time.Unix(sm.EndTime, 0) + now := time.Now() + diff := end.Sub(now) + + return fmt.Sprintf("%s:\nRotation ends at %s (in %s)\nMaps: %s\nRule: %s\n", sm.Mode, end.Format(time.RFC3339), diff, maps, sm.Rule) +} + +type splatoonGameMode struct { + Key string `json:"key"` + Name string `json:"name"` +} + +func (sgm splatoonGameMode) String() string { + return sgm.Name +} + +type splatoonRule struct { + Key string `json:"key"` + MultilineName string `json:"multiline_name"` + Name string `json:"name"` +} + +func (sr splatoonRule) String() string { + return sr.Name +} + +type splattus struct { + UpdateTime int64 `json:"updateTime"` + Modes struct { + League []splatoonMode `json:"league"` + Regular []splatoonMode `json:"regular"` + Gachi []splatoonMode `json:"gachi"` + } `json:"modes"` +} diff --git a/_tg/covfefe/main.go b/_tg/covfefe/main.go new file mode 100644 index 0000000..659a4eb --- /dev/null +++ b/_tg/covfefe/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "os" + + _ "github.com/Xe/x/tg/covfefe/commands" + _ "github.com/joho/godotenv/autoload" + "github.com/syfaro/finch" + _ "github.com/syfaro/finch/commands/help" + _ "github.com/syfaro/finch/commands/info" +) + +func main() { + f := finch.NewFinch(os.Getenv("TELEGRAM_TOKEN")) + + f.Start() +} diff --git a/_tg/meirl/.gitignore b/_tg/meirl/.gitignore new file mode 100644 index 0000000..5f118ff --- /dev/null +++ b/_tg/meirl/.gitignore @@ -0,0 +1,2 @@ +.env +meirl \ No newline at end of file diff --git a/_tg/meirl/gopreload.go b/_tg/meirl/gopreload.go new file mode 100644 index 0000000..6829ae5 --- /dev/null +++ b/_tg/meirl/gopreload.go @@ -0,0 +1,9 @@ +// gopreload.go +package main + +/* + This file is separate to make it very easy to both add into an application, but + also very easy to remove. +*/ + +import _ "github.com/Xe/gopreload" diff --git a/_tg/meirl/gops.go b/_tg/meirl/gops.go new file mode 100644 index 0000000..184b656 --- /dev/null +++ b/_tg/meirl/gops.go @@ -0,0 +1,13 @@ +package main + +import ( + "log" + + "github.com/google/gops/agent" +) + +func init() { + if err := agent.Listen(nil); err != nil { + log.Fatal(err) + } +} diff --git a/_tg/meirl/main.go b/_tg/meirl/main.go new file mode 100644 index 0000000..0be348f --- /dev/null +++ b/_tg/meirl/main.go @@ -0,0 +1,110 @@ +package main + +import ( + "fmt" + "log" + "os" + "runtime" + "time" + + "github.com/McKael/madon" + "github.com/Xe/ln" + "github.com/caarlos0/env" + _ "github.com/joho/godotenv/autoload" + "github.com/turnage/graw" + "github.com/turnage/graw/reddit" + "gopkg.in/telegram-bot-api.v4" +) + +const appid = "github.com/Xe/x/tg/meirl" +const version = "0.1-dev" + +type config struct { + RedditBotAdmin string `env:"REDDIT_ADMIN_USERNAME,required"` + Subreddits []string `env:"SUBREDDITS,required"` + + TelegramToken string `env:"TELEGRAM_TOKEN,required"` + TelegramAdmin string `env:"TELEGRAM_ADMIN,required"` + TelegramChannelID int64 `env:"TELEGRAM_CHANNEL_ID,required"` + + MastodonToken string `env:"MASTODON_TOKEN,required"` + MastodonClientSecret string `env:"MASTODON_CLIENT_SECRET,required"` + MastodonClientID string `env:"MASTODON_CLIENT_ID,required"` + MastodonInstance string `env:"MASTODON_INSTANCE,required"` +} + +func main() { + var cfg config + err := env.Parse(&cfg) + if err != nil { + ln.Fatal(ln.F{"err": err, "action": "env.Parse"}) + } + + tg, err := tgbotapi.NewBotAPI(cfg.TelegramToken) + if err != nil { + ln.Fatal(ln.F{"err": err, "action": "tgbotapi.NewBotAPI"}) + } + + ln.Log(ln.F{"action": "telegram_active", "username": tg.Self.UserName}) + + userAgent := fmt.Sprintf( + "%s on %s %s:%s:%s (by /u/%s)", + runtime.Version(), runtime.GOOS, runtime.GOARCH, + appid, version, cfg.RedditBotAdmin, + ) + + rd, err := reddit.NewScript(userAgent, 5*time.Second) + if err != nil { + ln.Fatal(ln.F{"err": err, "user_agent": userAgent}) + } + _ = rd + + ln.Log(ln.F{"action": "reddit_connected", "user_agent": userAgent}) + + md, err := madon.RestoreApp("me_irl", cfg.MastodonInstance, cfg.MastodonClientID, cfg.MastodonClientSecret, &madon.UserToken{AccessToken: cfg.MastodonToken}) + if err != nil { + ln.Fatal(ln.F{"err": err, "action": "madon.RestoreApp"}) + } + + a := &announcer{ + cfg: &cfg, + tg: tg, + md: md, + } + + stop, wait, err := graw.Scan(a, rd, graw.Config{Subreddits: cfg.Subreddits, Logger: log.New(os.Stderr, "", log.LstdFlags)}) + if err != nil { + ln.Fatal(ln.F{"err": err, "action": "graw.Scan", "subreddits": cfg.Subreddits}) + } + defer stop() + + // This time, let's block so the bot will announce (ideally) forever. + if err := wait(); err != nil { + ln.Fatal(ln.F{"err": err, "action": "reddit_wait"}) + } +} + +type announcer struct { + cfg *config + tg *tgbotapi.BotAPI + md *madon.Client +} + +func (a *announcer) Post(post *reddit.Post) error { + txt := fmt.Sprintf("me irl\n%s\n(https://reddit.com%s by /u/%s)", post.URL, post.Permalink, post.Author) + + msg := tgbotapi.NewMessage(a.cfg.TelegramChannelID, txt) + tmsg, err := a.tg.Send(msg) + if err != nil { + return err + } + + toot, err := a.md.PostStatus(txt, 0, nil, false, "", "public") + if err != nil { + return err + } + + ln.Log(ln.F{"action": "new_post", "url": post.URL, "permalink": post.Permalink, "redditor": post.Author, "toot_id": toot.ID, "tg_id": tmsg.MessageID}) + + return nil +} diff --git a/_tg/pbot/main.go b/_tg/pbot/main.go new file mode 100644 index 0000000..47f532f --- /dev/null +++ b/_tg/pbot/main.go @@ -0,0 +1,147 @@ +package main + +import ( + "fmt" + "image" + "log" + "net/http" + "os" + "runtime" + "time" + + "github.com/Xe/uuid" + "github.com/fogleman/primitive/primitive" + _ "github.com/joho/godotenv/autoload" + "gopkg.in/telegram-bot-api.v4" + + // image formats + _ "image/jpeg" + _ "image/png" + + _ "github.com/hullerob/go.farbfeld" + _ "golang.org/x/image/bmp" + _ "golang.org/x/image/tiff" + _ "golang.org/x/image/webp" +) + +func main() { + bot, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_TOKEN")) + if err != nil { + log.Panic(err) + } + + ps, ok := puushLogin(os.Getenv("PUUSH_KEY")) + if !ok { + log.Fatal("puush login failed") + } + + u := tgbotapi.NewUpdate(0) + u.Timeout = 60 + + updates, err := bot.GetUpdatesChan(u) + + for update := range updates { + if update.Message == nil { + continue + } + + err := renderImg(bot, ps, update) + if err != nil { + msg := tgbotapi.NewMessage(update.Message.Chat.ID, "error: "+err.Error()) + log.Printf("error in processing message from %s: %v", update.Message.From.String(), err) + bot.Send(msg) + } + } +} + +func stepImg(img image.Image, count int) image.Image { + bg := primitive.MakeColor(primitive.AverageImageColor(img)) + model := primitive.NewModel(img, bg, 512, runtime.NumCPU()) + + for range make([]struct{}, count) { + model.Step(primitive.ShapeTypeTriangle, 128, 0) + } + + return model.Context.Image() +} + +func renderImg(bot *tgbotapi.BotAPI, ps string, update tgbotapi.Update) error { + msg := update.Message + + if msg == nil { + return nil + } + + // ignore chats without photos + if *msg.Photo == nil { + return nil + } + + if m := *msg.Photo; len(m) == 0 { + return nil + } + + p := *msg.Photo + pho := p[len(p)-1] + fu, err := bot.GetFileDirectURL(pho.FileID) + if err != nil { + return err + } + + resp, err := http.Get(fu) + if err != nil { + return err + } + defer resp.Body.Close() + + img, ifmt, err := image.Decode(resp.Body) + if err != nil { + return err + } + + log.Printf("%s: image id %s loaded (%s)", msg.From, pho.FileID, ifmt) + umsg := tgbotapi.NewMessage(update.Message.Chat.ID, "rendering... (may take a while)") + bot.Send(umsg) + + before := time.Now() + imgs := []image.Image{} + + for i := range make([]struct{}, 10) { + log.Printf("%s: starting frame render", msg.From) + imgs = append(imgs, stepImg(img, 150)) + log.Printf("%s: frame rendered", msg.From) + + umsg = tgbotapi.NewMessage(update.Message.Chat.ID, fmt.Sprintf("frame %d/10 rendered", i+1)) + bot.Send(umsg) + } + + gpath := "./var/" + update.Message.From.String() + ".gif" + err = primitive.SaveGIFImageMagick(gpath, imgs, 15, 15) + if err != nil { + return err + } + + after := time.Now().Sub(before) + + buf, err := os.Open(gpath) + if err != nil { + return err + } + defer os.Remove(gpath) + + umsg = tgbotapi.NewMessage(update.Message.Chat.ID, "uploading (took "+after.String()+" to render)") + bot.Send(umsg) + + furl, err := puush(ps, uuid.New()+".gif", buf) + if err != nil { + return err + } + + omsg := tgbotapi.NewMessage(update.Message.Chat.ID, furl.String()) + _, err = bot.Send(omsg) + if err != nil { + return err + } + + return nil +} diff --git a/_tg/pbot/puush.go b/_tg/pbot/puush.go new file mode 100644 index 0000000..259cb56 --- /dev/null +++ b/_tg/pbot/puush.go @@ -0,0 +1,93 @@ +package main + +import ( + "bytes" + "crypto/md5" + "errors" + "fmt" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "net/url" + "strings" +) + +// Puush constants +const ( + PuushBase = "https://puush.me/api/" + PuushAuthURL = "https://puush.me/api/auth/" + PuushUploadURL = "https://puush.me/api/up/" +) + +func puushLogin(key string) (string, bool) { + r, err := http.PostForm(PuushAuthURL, url.Values{"k": {key}}) + if err != nil { + fmt.Println(err) + return "", false + } + body, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + info := strings.Split(string(body), ",") + if info[0] == "-1" { + return "", false + } + + session := info[1] + return session, true +} + +func puush(session, fname string, fin io.Reader) (*url.URL, error) { + buf := new(bytes.Buffer) + w := multipart.NewWriter(buf) + kwriter, err := w.CreateFormField("k") + if err != nil { + return nil, err + } + + io.WriteString(kwriter, session) + + file, _ := ioutil.ReadAll(fin) + + h := md5.New() + h.Write(file) + + cwriter, err := w.CreateFormField("c") + if err != nil { + return nil, err + } + io.WriteString(cwriter, fmt.Sprintf("%x", h.Sum(nil))) + + zwriter, err := w.CreateFormField("z") + if err != nil { + return nil, err + } + io.WriteString(zwriter, "poop") // They must think their protocol is shit + + fwriter, err := w.CreateFormFile("f", fname) + if err != nil { + return nil, err + } + fwriter.Write(file) + + w.Close() + + req, err := http.NewRequest("POST", "http://puush.me/api/up", buf) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", w.FormDataContentType()) + client := &http.Client{} + res, err := client.Do(req) + if err != nil { + return nil, err + } + body, _ := ioutil.ReadAll(res.Body) + res.Body.Close() + info := strings.Split(string(body), ",") + if info[0] == "0" { + return url.Parse(info[1]) + } + + return nil, errors.New("upload failed") +} diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/dce.go b/_tg/pbot/vendor/github.com/Xe/uuid/dce.go new file mode 100644 index 0000000..50a0f2d --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/dce.go @@ -0,0 +1,84 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) UUID { + uuid := NewUUID() + if uuid != nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCEPerson(Person, uint32(os.Getuid())) +func NewDCEPerson() UUID { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCEGroup(Group, uint32(os.Getgid())) +func NewDCEGroup() UUID { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID or false. +func (uuid UUID) Domain() (Domain, bool) { + if v, _ := uuid.Version(); v != 2 { + return 0, false + } + return Domain(uuid[9]), true +} + +// Id returns the id for a Version 2 UUID or false. +func (uuid UUID) Id() (uint32, bool) { + if v, _ := uuid.Version(); v != 2 { + return 0, false + } + return binary.BigEndian.Uint32(uuid[0:4]), true +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/doc.go b/_tg/pbot/vendor/github.com/Xe/uuid/doc.go new file mode 100644 index 0000000..d8bd013 --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/doc.go @@ -0,0 +1,8 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The uuid package generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services. +package uuid diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/hash.go b/_tg/pbot/vendor/github.com/Xe/uuid/hash.go new file mode 100644 index 0000000..cdd4192 --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known Name Space IDs and UUIDs +var ( + NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") + NIL = Parse("00000000-0000-0000-0000-000000000000") +) + +// NewHash returns a new UUID dervied from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space) + h.Write([]byte(data)) + s := h.Sum(nil) + uuid := make([]byte, 16) + copy(uuid, s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/node.go b/_tg/pbot/vendor/github.com/Xe/uuid/node.go new file mode 100644 index 0000000..dd0a8ac --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/node.go @@ -0,0 +1,101 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "net" + +var ( + interfaces []net.Interface // cached list of interfaces + ifname string // name of interface being used + nodeID []byte // hardware for version 1 UUIDs +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil && name != "" { + return false + } + } + + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + if setNodeID(ifs.HardwareAddr) { + ifname = ifs.Name + return true + } + } + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + if nodeID == nil { + nodeID = make([]byte, 6) + } + randomBits(nodeID) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + if nodeID == nil { + SetNodeInterface("") + } + nid := make([]byte, 6) + copy(nid, nodeID) + return nid +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if setNodeID(id) { + ifname = "user" + return true + } + return false +} + +func setNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + if nodeID == nil { + nodeID = make([]byte, 6) + } + copy(nodeID, id) + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + if len(uuid) != 16 { + return nil + } + node := make([]byte, 6) + copy(node, uuid[10:]) + return node +} diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/time.go b/_tg/pbot/vendor/github.com/Xe/uuid/time.go new file mode 100644 index 0000000..b9369c2 --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/time.go @@ -0,0 +1,132 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + mu sync.Mutex + lasttime uint64 // last time we returned + clock_seq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// adjusts the clock sequence as needed. An error is returned if the current +// time cannot be determined. +func GetTime() (Time, error) { + defer mu.Unlock() + mu.Lock() + return getTime() +} + +func getTime() (Time, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clock_seq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clock_seq = ((clock_seq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence a new random +// clock sequence is generated the first time a clock sequence is requested by +// ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) sequence is generated +// for +func ClockSequence() int { + defer mu.Unlock() + mu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clock_seq == 0 { + setClockSequence(-1) + } + return int(clock_seq & 0x3fff) +} + +// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer mu.Unlock() + mu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + old_seq := clock_seq + clock_seq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if old_seq != clock_seq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. It returns false if uuid is not valid. The time is only well defined +// for version 1 and 2 UUIDs. +func (uuid UUID) Time() (Time, bool) { + if len(uuid) != 16 { + return 0, false + } + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time), true +} + +// ClockSequence returns the clock sequence encoded in uuid. It returns false +// if uuid is not valid. The clock sequence is only well defined for version 1 +// and 2 UUIDs. +func (uuid UUID) ClockSequence() (int, bool) { + if len(uuid) != 16 { + return 0, false + } + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff, true +} diff --git a/_tg/pbot/vendor/github.com/Xe/uuid/util.go b/_tg/pbot/vendor/github.com/Xe/uuid/util.go new file mode 100644 index 0000000..de40b10 --- /dev/null +++ b/_tg/pbot/vendor/github.com/Xe/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts the the first two hex bytes of x into a byte. +func xtob(x string) (byte, bool) { + b1 := xvalues[x[0]] + b2 := xvalues[x[1]] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a