Skip to content

Instantly share code, notes, and snippets.

View colecrouter's full-sized avatar

Cole Crouter colecrouter

  • Brandt Tractor Ltd.
  • Canada
View GitHub Profile
@colecrouter
colecrouter / preview.png.ts
Last active March 20, 2022 07:48
ES6 janky png editing NO CANVAS Cloudflare Workers/Pages Functions
import { Inventory, Item, SharedKit } from '../types/kit';
import { decode, encode, toRGBA8 } from 'upng-js';
let MCTEXTURES: Textures;
const INV_WIDTH = 181;
const INV_HEIGHT = 115;
const ITEM_WIDTH = 32;
const ITEM_HEIGHT = 32;
@colecrouter
colecrouter / 404.html
Last active January 21, 2022 22:17
HTML5 Flopping Minecraft Fish 404 Page
<!-- For the sake of performance, I'm going to include everything into one file -->
<!doctype HTML5>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
<meta name=" author" content="Cole Crouter">
<meta name="twitter:card" content="summary">
<meta name="twitter:description" content="This is not the page you are looking for...">
<meta name="twitter:image"
content="https://static.wikia.nocookie.net/minecraft_gamepedia/images/f/fc/Bucket_JE2_BE2.png/revision/latest/scale-to-width-down/160?cb=20200510234539">
@colecrouter
colecrouter / autocomplete.go
Created June 19, 2021 06:10
Bash autocomplete with static and dynamic suggestions in Go
/*
There's very little info on how to programmatically do bash autocomplete online, much less how to do it outside of
the bash language. I've used libraries, such as posener/complete, but they don't let you build autocomplete
behaviour how you want to. In my case, I'm using gRPC to get data from servers across the globe, so it doesn't make
sense to fetch *all* the info you *could* need, every time for both dynamic & static suggestions. Here I've made a
program that has static subcommands (predefined), but uses functions to get dynamic suggestion after that, such as
"'stop serverX' as long as serverX is online", where "stop" is static, but "serverX" is dynamic. To use this in
practice, you'll have to compile like this:
go build autocomplete.go
then add this command to your .bashrc or .zshrc: