Skip to content

Instantly share code, notes, and snippets.

View apg's full-sized avatar
🐢
Turtle

Andrew Gwozdziewycz apg

🐢
Turtle
View GitHub Profile
@apg
apg / hack-and-tell-wrapup-19.md
Created November 9, 2012 11:34
Hack and Tell Round 19 Wrap up!

Subject: Round 19: Beware of the spooks.

(Have a complaint about this email? Want to make it better, fix a typo, or add more info? Fork the gist on GitHub! https://gist.github.com/4045257)

Hello Hackers-

Thanks to Facebook NYC for hosting us! I always give Facebook a lot of crap, but they were very gracious

@apg
apg / rc4.scm
Created November 9, 2012 11:18
RC4 (e.g. ARCFOUR) in (Guile) Scheme. Yes, this is vulnerable in many ways, since it's straight up RC4.
;;; RC4, just for the hell of it.
;;; Written for Guile 2.0+
;;; Use like so:
;;; Encypher: (rc4 "Key" (map char->integer (string->list "Plaintext")))
;;; $1 = (187 243 22 232 217 64 175 10 211)
;;; Decypher: (rc4 "Key" $1)
;;; $2 = (80 108 97 105 110 116 101 120 116)
(define (rc4-make-schedule key)
(let ((L (string-length key)))
@apg
apg / hygme.scm
Created September 7, 2012 11:43
A simple interpreter (probably not completely functional) with hygienic macro expansion.
;; Hygme. A simple language with a hygienic macro expander.
;;
;; Abs -> (fn var body)
;; Var -> <symbol>
;; Const -> <string> | <symbol> | <number> | <boolean> ...
;; Cond -> (if <condition> <consequent> <alternate>)
;; Assm -> (set! var value)
;; App -> (<expr> <expr> ...)
;;
;; in the environment: cons, car, cdr, list, not, +, -, *, /
@apg
apg / pool.go
Created August 9, 2012 10:07
untested (but probably functional) Go pool
package pool
import (
"container/list"
"sync"
)
type Pool struct {
capacity int
cons func() interface{}
@apg
apg / round-18-wrapup.md
Created July 27, 2012 10:29
Hack and Tell Round 18 Wrap up!

Subject: Round 18: Wrap Up, Schmap Up

(Have a complaint about this email? Want to make it better, fix a typo, or add more info? Fork the gist on GitHub!)

Hello Hackers-

Thanks to Meetup for hosting us! They've supported us since the very beginning, and of course are amazing hosts!

@apg
apg / methreflect.go
Created July 9, 2012 17:43
playing with go reflection, for more declarative msgpack RPC server creation?
package main
import (
"fmt"
"reflect"
)
type Server struct {
name string
}
@apg
apg / gist:2987911
Created June 25, 2012 10:49
Whole buffer version of replace-string
(defun replace-string-beg-buffer ()
"Whole buffer version of `replace-string'"
(interactive)
(save-excursion
(beginning-of-buffer)
(call-interactively 'replace-string)))
@apg
apg / dumphosts.py
Created June 7, 2012 14:44
Write a hosts file based on all the current instances in 'running' state on EC2
import sys
import os
import boto
from optparse import OptionParser
from contextlib import closing
parser = OptionParser()
parser.add_option('-a', '--access-key', default=None, dest='access_key',
help="AWS access key (required)")
@apg
apg / round-17-wrapup.md
Created May 19, 2012 17:21
Cease fire! The war is over? (Hack and Tell Round 17: Wrap up!)

Subject: Cease fire! The war is over? (Round 17: Wrap up!)

(Turns out, I have no idea when the Germanian war that started in 17 AD ended, but if you happen to know, feel free to reach out.[0])

(Have a complaint about this email? Want to make it better, fix a typo, or add more info? Fork the gist on GitHub!)

Hello Hackers-

(define-image "/tmp/push.png" (500 500)
(steps
(move 0 0)
(rectangle 0 0 500 500)
(color 0.2 0.2 0.2 1.0)
(fill)
(push)
(translate 250 250)