Skip to content

Instantly share code, notes, and snippets.

View jkinred's full-sized avatar
🐵

Jonathan Kinred jkinred

🐵
View GitHub Profile
@jkinred
jkinred / gist:3478641
Created August 26, 2012 12:41
Is this thread unsafe?
class Foo(object):
def __init__(self, client):
self._cache = {}
self.client = client
def get():
client.get_from_server()
class Bar(object):
def __init__(self, client):
class BuildResultKey(object):
def __init__(self, project_key, plan_key, job_key, build_number=None):
self.project_key = project_key
self.plan_key = plan_key
self.job_key = job_key
self.build_number = build_number
def __str__(self):
return "%s-%s-%s" % (self.project_key, self.plan_key, self.job_key)
@jkinred
jkinred / MRI-41808.patch
Last active December 28, 2015 11:29
Patch Ruby 1.9.3-p374 to build on Fedora 19.
--- trunk/ext/openssl/ossl_pkey_ec.c 2013/07/05 22:16:09 41807
+++ trunk/ext/openssl/ossl_pkey_ec.c 2013/07/05 22:46:42 41808
@@ -762,8 +762,10 @@
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
@jkinred
jkinred / MRI-41808-notests.patch
Last active December 28, 2015 11:29
Patch Ruby 1.8.7-p357 to build on Fedora 19.
--- trunk/ext/openssl/ossl_pkey_ec.c 2013/07/05 22:16:09 41807
+++ trunk/ext/openssl/ossl_pkey_ec.c 2013/07/05 22:46:42 41808
@@ -762,8 +762,10 @@
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
#!/usr/bin/env python
import datetime
from igc2kmz.igc import IGC
garmin = IGC(open('blackheath_blackville_garmin.igc'))
compeo = IGC(open('blackheath_blackville_compeo.igc'))
g_track = garmin.track()
c_track = compeo.track()
@jkinred
jkinred / gist:7964830
Last active December 31, 2015 09:09
Code used to combine a Compeo+ and 76s tracklog.
#!/usr/bin/env python
import datetime
from igc2kmz.igc import IGC
garmin = IGC(open('blackheath_blackville_garmin.igc'))
compeo = IGC(open('blackheath_blackville_compeo.igc'))
g_track = garmin.track()
c_track = compeo.track()
@jkinred
jkinred / gist:9404888
Created March 7, 2014 03:43
Interpretation of HAproxy manual in regard to HTTP keepalive
It seems that these two statements from http://haproxy.1wt.eu/download/1.4/doc/configuration.txt are not consistent.
In "1.1. The HTTP transaction model" section:
"Once established, the connection is persisted both on the client and
server sides."
In "option http-server-close" section:
"By default, when a client communicates with a server, HAProxy will only
analyze, log, and process the first request of each connection."
`Or else what?' said Alice, for the Knight had made a sudden pause.
`Or else it doesn't, you know. The name of the song is called "Haddocks' Eyes."'
`Oh, that's the name of the song, is it?' Alice said, trying to feel interested.
`No, you don't understand,' the Knight said, looking a little vexed. `That's what the name is called. The name really is "The Aged Aged Man."'
`Then I ought to have said "That's what the song is called"?' Alice corrected herself.
@jkinred
jkinred / bootstrap_flux.md
Created July 18, 2018 10:51
Bootstrap Flux into a K8s cluster

Bootstrap flux into a cluster

These instructions assume a working cluster with the Helm Tiller already installed.

[email protected]:jkinred/flux-example
helm install \
    --name flux \
    --set helmOperator.create=true \

--set git.url=$GIT_REPO \

@jkinred
jkinred / gist:a9d10f6c98d10e79f32567e0331dd1f3
Created September 13, 2019 03:32
All availability zones in all regions
for region in `aws ec2 describe-regions --all-regions | jq -r .Regions[].RegionName`; do aws ec2 describe-availability-zones --region $region | jq .AvailabilityZones[].ZoneName; done