Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Grandpre jimtla

  • Spring
View GitHub Profile
View gist:689aa663152b73a3f4a6
S3 traceroute:
traceroute to s3-1-w.amazonaws.com (54.231.0.145), 64 hops max, 52 byte packets
1 104.36.1.1 (104.36.1.1) 3.439 ms 2.982 ms 3.082 ms
2 172.16.66.17 (172.16.66.17) 4.792 ms 4.924 ms 3.081 ms
3 172.16.70.41 (172.16.70.41) 1.868 ms 6.502 ms 8.978 ms
4 xe-0-3-0-17.r06.nycmny01.us.bb.gin.ntt.net (129.250.192.129) 2.753 ms 2.169 ms 2.273 ms
5 ae-9.amazon.nycmny01.us.bb.gin.ntt.net (129.250.201.130) 2.094 ms
ae-11.amazon.nycmny01.us.bb.gin.ntt.net (129.250.201.138) 2.475 ms
ae-10.amazon.nycmny01.us.bb.gin.ntt.net (129.250.201.134) 2.133 ms
6 54.240.229.78 (54.240.229.78) 8.173 ms
View gist:712ab5462dfc0548a897
#![feature(collections)]
#![feature(box_patterns)]
#[derive(Clone, Debug)]
enum Regex {
Term(RegexTerm),
Or(RegexTerm, Box<Regex>),
}
impl Regex {
View gist:acbc4ce933dd47514f1d
#![feature(collections)]
#![feature(box_patterns)]
#[cfg(feature = "simple")]
pub fn matches(regex : &str, target : &str) -> bool {
match (regex.slice_shift_char(), target.slice_shift_char()) {
// Both strings are emtpy, so we've got a match.
(None, None) => true,
// We're looking at _*, match the kleene star.
@jimtla
jimtla / gist:6c5191760729d0ec2502
Created Aug 22, 2014
Code Sample for Go Leaks blog post
View gist:6c5191760729d0ec2502
21 @ 0x26be6 0x12f4d 0x135bc 0x69d24 0x26db0
# 0x69d24 jello/models.resizeAndWrite+0x6145
~/go/src/jello/models/photo.go:149
@jimtla
jimtla / gist:6693f7614ecfcd5fa7e9
Created Aug 21, 2014
Code Sample for Go Leaks blog post
View gist:6693f7614ecfcd5fa7e9
func createAlternateSizes(photoPath string, img image.Image, block bool) error {
// Put a white background on all the resized images.
whiteImg := imageWithWhiteBg(img)
numberOfResizes := 3
c := make(chan error, numberOfResizes)
go resizeAndWrite(whiteImg, 640, photoPath + "_f", c)
go resizeAndWrite(whiteImg, 290, photoPath + "_s", c)
go resizeAndWrite(whiteImg, 200, photoPath + "_d", c)
@jimtla
jimtla / gist:32dab1bb0ea0424710f8
Last active Aug 29, 2015
Code Sample for Go Leaks blog post
View gist:32dab1bb0ea0424710f8
func createAlternateSizes(photoPath string, img image.Image, block bool) error {
// Put a white background on all the resized images.
whiteImg := imageWithWhiteBg(img)
c := make(chan error, 0)
go resizeAndWrite(whiteImg, 640, photoPath + "_f", c)
go resizeAndWrite(whiteImg, 290, photoPath + "_s", c)
go resizeAndWrite(whiteImg, 200, photoPath + "_d", c)
if block {
@jimtla
jimtla / resizeAndWrite.go
Last active Aug 29, 2015
Code Sample for Go Leaks blog post
View resizeAndWrite.go
func resizeAndWrite(img image.Image, width int, path string, c chan error) {
newImg := resize.Resize(uint(width), 0, img, resize.Bicubic)
err := writeJpegToS3(s, newImg, path)
// Write back to the channel with the status of the S3 write operation.
c <- err
}
@jimtla
jimtla / main.go
Created Aug 21, 2014
Test Program for Golang's heap profiler
View main.go
package main
import (
"log"
"net/http"
_ "net/http/pprof"
)
func wasteMemory() {
s := "ABCDEFGHIJKLMNOPQRSTUVWXYZ00123456789"
View gist:9458021
### Keybase proof
I hereby claim:
* I am jimtla on github.
* I am jimtla (https://keybase.io/jimtla) on keybase.
* I have a public key whose fingerprint is 9997 4223 B138 49BF 6F43 C80F AA4A 7117 AC09 F449
To claim this, I am signing this object:
View skeinhashbreaker.py
import skein
from random import choice
target = '5b4da95f5fa08280fc9879df44f418c8f9f12ba424b7757de02bbdfbae0d4c4fdf9317c80cc5fe04c6429073466cf29706b8c25999ddd2f6540d4475cc977b87f4757be023f19b8f4035d7722886b78869826de916a79cf9c94cc79cd4347d24b567aa3e2390a573a373a48a5e676640c79cc70197e1c5e7f902fb53ca1858b6'
def bitcount(v):
if v > 0:
return (v & 1) + bitcount(v>>1)
else:
return 0