Skip to content

Instantly share code, notes, and snippets.

View mike-burns's full-sized avatar
💭
GitLab

Mike Burns mike-burns

💭
GitLab
View GitHub Profile
@mike-burns
mike-burns / main.c
Created April 5, 2015 16:33
How does GTK+3 want to open your file?
/*
* gcc -g `pkg-config gtk+-3.0 --libs --cflags` main.c -o main
*/
#include <err.h>
#include <stddef.h>
#include <stdlib.h>
#include <gtk/gtk.h>
@mike-burns
mike-burns / .msmtp
Last active December 23, 2022 14:56
FastMail + mutt
account default
host mail.messagingengine.com
port 587
protocol smtp
auth on
from mike@mike-burns.com
user mikeburns@fastmail.fm
password topsecretpassword!
tls on
tls_nocertcheck
@mike-burns
mike-burns / apm_ctldev.c
Created November 8, 2014 04:19
Suspend your machine
/* Does not work if apmd(8) is running. */
/* Requires read-write access to /dev/apmctl. */
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <machine/apmvar.h>
#include <fcntl.h>
def mc_sort(l)
a = l.dup
while (! sorted?(a))
a.shuffle!
end
a
end
*dynamicColors:true
*rightScrollBar:true
*reverseWrap:true
*multiScroll:true
*scrollTtyOutput:false
*scrollKey:true
*saveLines:10000
*showMissingGlyphs:true
*termName:xterm-new
*colorULMode:true
@mike-burns
mike-burns / gist:11287855
Created April 25, 2014 12:24
Time-based One-Time Passwords
= HMAC (H-based Message Authentication Codes):
RFC 2104
H is the hashing function.
HMAC-SHA1 sets H=SHA1.
H(K xor O, H(K xor I, E))
where
K = shared secret key
O = padding, 0x5C repeated B times
I = padding, 0x36 repeated B times
if true {
fileinto "Inbox";
addflag "\\Seen";
fileinto "INBOX.Archive";
removeflag "\\Seen";
}
@mike-burns
mike-burns / bug
Last active August 29, 2015 13:56
HQ9+ in sh
#!/bin/sh
main() {
hello_world=0
quine=0
nine=0
plus=0
accumulator=0
while getopts hq9+ opt; do
@mike-burns
mike-burns / thingy_and_its_maker.py
Created September 5, 2013 19:56
Example builder pattern in Python
class ThingyMaker(object):
def __init__(self):
self.thingy = None
self.widget = None
def with_thingy(self, thingy):
self.thingy = thingy
return self
def with_widget(self, widget):
@mike-burns
mike-burns / io.rb
Created August 25, 2013 02:17
Haskell's IO implemented in Ruby
class Io
attr_reader :action
def initialize(&action)
@action = action
end
def bind(&f)
Io.new do
result = @action.call
f.call(result)