Skip to content

Instantly share code, notes, and snippets.

@ivey
ivey / blog.pl
Created November 23, 2022 00:37
#!/usr/bin/perl
# blog: a utility to run a weblog
#
# Copyright (C) 1999 Michael D. Ivey <ivey@gweezlebur.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
from math import floor
from datetime import datetime, timedelta
from time import mktime
import plugins
def _initialise(bot):
plugins.register_handler(_handle_cp_action)
@ivey
ivey / pretty_print_middleware.go
Created August 26, 2015 21:53
Pretty print middleware for Go
import "net/http/httptest"
func (a *IndentJSONMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
rec := httptest.NewRecorder()
a.handler.ServeHTTP(rec, r)
for k, v := range rec.Header() {
w.Header()[k] = v
}
@ivey
ivey / gist:c7a693ba3347792f802c
Created April 23, 2015 15:04
Text of email "Bay Minette Elementary Update" dated 4/22/2015 8:58 PM from news@bcbe.org
Bay Minette Elementary School Parents:
As you are likely aware, Amec Foster Wheeler, an environmental consulting firm, and the Environmental Protection Agency have been on-site at Bay Minette Elementary School conducting inspections of the facility and reviewing test results.
I am including a link to the review letter issued today by the environmental consulting firm and a link to the data upon which the review letter is based. According to Richard Brown, "The preliminary findings of the EPA inspection did not identify immediate health hazards relative to asbestos exposure at the school. Results of the air testing at the school for fibers such as asbestos did not indicate fibers above regulatory levels." Please note that the testing and inspections have been conducted in consultation with the Board's consultant and the Environmental Protection Agency. In the event of any differences in testing standards, the more rigorous standards have been used.
Along with the letter, the Board is complying with the f
@ivey
ivey / gist:b34177cb7e9d4111583a
Created December 29, 2014 22:27
behavior_tree_builder.go
b := gobt.NewTreeBuilder()
tree := b.Tree("test",
b.Sequence("try some things",
b.Selector("1 of 3",
b.Action("fail at something",
func(player interface{}, bb *gobt.Blackboard) bool {
fmt.Println("a1: ", bb)
return false
}),
### Keybase proof
I hereby claim:
* I am ivey on github.
* I am ivey (https://keybase.io/ivey) on keybase.
* I have a public key whose fingerprint is 2ABD 95F6 54E1 7E04 70D4 B8D1 8473 F73D E6D0 EB16
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am ivey on github.
* I am ivey (https://keybase.io/ivey) on keybase.
* I have a public key whose fingerprint is F4E1 D771 731E ED83 BFEF 6F4A 6604 D5C0 D25C DBF6
To claim this, I am signing this object:
@ivey
ivey / .slate.js
Created October 15, 2013 01:31
flexiglass-style bindings for slate (https://github.com/jigish/slate)
// other window
slate.bind('p:ctrl,cmd,alt', function(win) {
var current = slate.screen().id();
var count = slate.screenCount() - 1;
var target = current + 1;
if (target > count) {
target = 0;
}
win.doOperation(slate.operation("throw", {
"screen": target,
config_path = File.expand_path("~/.nexus_cli")
config = File.exists?(config_path) ? YAML::load_file(config_path) : {}
(defun intelligent-close ()
"quit a frame the same way no matter what kind of frame you are on"
(interactive)
(if (eq (car (visible-frame-list)) (selected-frame))
;;for parent/master frame...
(if (> (length (visible-frame-list)) 1)
;;close a parent with children present
(delete-frame (selected-frame))