Skip to content

Instantly share code, notes, and snippets.

View tarcieri's full-sized avatar

Tony Arcieri tarcieri

View GitHub Profile
@tarcieri
tarcieri / Concurrent Object-Oriented Programming in Python with ATOM.pdf
Last active August 29, 2015 13:57
Concurrent Object-Oriented Programming in Python with ATOM
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def phase(differential, max, offset)
absolute = (differential * max + offset) % max
relative = absolute - max / 2
relative < 0 ? -relative : relative
end
# Vulnerable
$ irb -ropenssl
2.1.1 :001 > OpenSSL::OPENSSL_VERSION
=> "OpenSSL 1.0.1f 6 Jan 2014"
# Not vulnerable
$ irb -ropenssl
2.1.1 :001 > OpenSSL::OPENSSL_VERSION
=> "OpenSSL 1.0.1g 7 Apr 2014"
@tarcieri
tarcieri / gist:11203420
Created April 23, 2014 05:15
gpg --gen-key: Why Johnny Can't Encrypt
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
@tarcieri
tarcieri / secret.rs
Last active August 29, 2015 14:01
Playing around with mmap()ed secret buffers in Rust
extern crate libc;
extern crate rand;
use std::os;
use std::cast::transmute;
use std::raw::Slice;
use std::intrinsics;
use libc::types::common::c95::c_void;
use libc::funcs::posix88::mman::{mmap, mlock, munmap};
m=255
r=(0..256)
j=0
Sk=r.to_a.map{|i|j=(j+S[i]+K[i%16])&m}
St=[]
i=j=0
r.each{|i|
i&=m
j=(j+S[i])&m
S[i],S[j]=S[j],S[i]
@tarcieri
tarcieri / gist:c0e7c06fc23e9cd3dd08
Created November 18, 2014 01:55
Some Sonic PI muzak
in_thread do
with_fx :reverb do
loop do
use_synth :tb303
play_pattern_timed chord(:E3, :m7), 0.25
end
end
end
in_thread do
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQENBFS2LA0BCACy/N3h9D5bK5Q5Ym4qOLoYc/qD4ttJ/icXtrvy3K5Kp2x8rwTm
fum6R4yaia2yeSeMvR0UZAIkOz2Pf5gyBc1x0A1UIyAxnkWTndL7GjxNP/bMoumY
otG3wCqf+QQPAqj5/X0k6jhVARRjRJaRaNQrj7mdboD2SJSxrIr0pw1JpBCWaAc+
ySuLwhaV1BjIxnS3sPztaWEgKth0ipjwlcOHskSJ1kAbjrnjicnw/D18EY9JBzJ4
yxj7i0JcTvK4F0we4l3MJ2kFjPLhk6pV4t3oTHZV7yUApTUnugPmDDiLH5YRjlEw
nxvHtOzGDM2CODn5PqX2nQ3T10srLMHNM8ErABEBAAG0IFRvbnkgQXJjaWVyaSA8
YmFzY3VsZUBnbWFpbC5jb20+iQE/BBMBAgApBQJUtiwNAhsDBQkSzAMABwsJCAcD
@tarcieri
tarcieri / redis_interleave_bug.rb
Last active August 29, 2015 14:13
Redis request interleaving repro (Ruby 2.1+)
require 'redis'
require 'timeout'
redis = Redis.new
redis.set('chunky', 'bacon')
res_a = nil
res_b = nil
count = 0
outer_count = 0
>> o = Object.new
=> #<Object:0x1110cdc>
>> class << o
>> FOO = 'bar'
>> end
=> "bar"
>> class << o; self; end::FOO
=> "bar"