Skip to content

Instantly share code, notes, and snippets.

Oliver Legg olly

Block or report user

Report or block olly

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@olly
olly / README.md
Last active Mar 6, 2018
`data-anonymization` `SelectFromDatabase` patch
View README.md

Prevents SQL error caused by primary_key not being set

Previously the SelectFromDatabase strategy connects to the database, and extracts the values, when it's initalized. However, at this stage,the table isn't fully configured and so when it creates the source table, it doesn't set a primary key.

By changing it to lazily fetch, and cache, the values; we ensure that the source table will be correctly configured.

View main.rs
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
extern crate chrono;
#[macro_use]
extern crate serde_json;
extern crate uuid;
use chrono::TimeZone;
View rails-merge-db-schema
#!/usr/bin/env ruby
#
# usage: rails-merge-db-schema <current-file> <base-file> <other-file> <marker-size>
#
# install:
#
# $ git config --global merge.railsschema.name "newer Rails schema version"
# $ git config --global merge.railsschema.driver "rails-merge-db-schema %A %O %B %L"
exit 1 if ARGV.size != 4
@olly
olly / set_test.rb
Created Apr 5, 2017
Ruby Set#include? strangeness
View set_test.rb
require 'minitest/autorun'
require 'set'
class Foo
def initialize(s)
@s = s
end
def ==(other)
@s == other
View keybase.md

Keybase proof

I hereby claim:

  • I am olly on github.
  • I am ollylegg (https://keybase.io/ollylegg) on keybase.
  • I have a public key ASCz5Gv6Xa5KiEHzGYm3agmh25E853LgPFwieUp2iq4Hqgo

To claim this, I am signing this object:

View SSL Client Auth Thoughts.md

Client SSL Authentication

The use case I had when I implemented client SSL authentication was to secure a web interface for a centralised log service that I was running. I wanted it to have it available, securely, on the public internet. I implemented it using nginx's ssl module.

I only had this available for 4-5 developers. I think I'd only attempt to use this for anyone who is comfortable with SSH keys or if it was an API client. I think the technical bar is a little too high for anything else.

I wrote some scripts, which I've pushed to a public GitHub repository: olly/heracles. The README is a mix of actual commands that work, and thoughts for how things could be configured. The idea was for it to generate CAs, server certificates and client certificates, and store them in a git repository for easy backup. There in a fairly rough state, but what's there works and I had tested on a real setup.

Authorizatio

@olly
olly / cheats.md
Created Mar 9, 2015
a personal vim cheatsheet
View cheats.md

vim cheatsheet

Copy & Paste

"ayw yank word into the "a" register
"Ayw yank word and append into the "a" register

Moving through a document

z<return> move current line to the top

View application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Troop</title>
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
</head>
<body>
View gist:963de94953d83c8094a3
class User
has_many :friendships
has_many :friends, through: :friendships
end
class Friendship
belongs_to :friend, class: User
belongs_to :friendee, class: User
end
View gist:11d117121a964023ff14
$ dig cachefly.alfredapp.com @8.8.8.8
; <<>> DiG 9.8.3-P1 <<>> cachefly.alfredapp.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49360
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;cachefly.alfredapp.com. IN A
You can’t perform that action at this time.