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 / 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
if true {
fileinto "Inbox";
addflag "\\Seen";
fileinto "INBOX.Archive";
removeflag "\\Seen";
}
@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
*dynamicColors:true
*rightScrollBar:true
*reverseWrap:true
*multiScroll:true
*scrollTtyOutput:false
*scrollKey:true
*saveLines:10000
*showMissingGlyphs:true
*termName:xterm-new
*colorULMode:true
def mc_sort(l)
a = l.dup
while (! sorted?(a))
a.shuffle!
end
a
end
@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>
@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>
require 'test_helper'
class OpenidsControllerTest < ActionController::TestCase
def setup
@openid_identity = Factory.next(:openid_identity)
end
should_route :get, '/openid', :controller => 'openids', :action => 'show'
should_route :put, '/openid', :controller => 'openids', :action => 'update'
class Float
define_method(:/) do |d|
if d.zero?
raise "Over 9000"
else
self - d
end
end
end
require 'test_helper'
class PostsTest < ActionController::IntegrationTest
def updating_a_post_successfully
user = Factory(:user)
i_am_signed_in_as(user)
post = Factory(:post, :user => user)
go_to(edit_post_path(post))
fill_in(:title, :with => 'Willard Scott')