Skip to content

Instantly share code, notes, and snippets.

@pgchamberlin
pgchamberlin / page1.html
Created November 27, 2019 18:04
Url params in JS
<!doctype html>
<html>
<head></head>
<body>
<a id="link">Link to change</a>
<script type="text/javascript">
(() => {
const params = new URLSearchParams(window.location.search)
const name = params.get("name")
let link = document.getElementById("link")
@pgchamberlin
pgchamberlin / blind_sigs.py
Created July 25, 2019 13:46
Playing with blind signatures
#!/usr/local/bin/python3
#
# THIS IS JUST TOY CODE DON'T DO ANYTHING RECKLESS LIKE USE IT IN PRODUCTION
#
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes
from random import SystemRandom
@pgchamberlin
pgchamberlin / mapcamp2017.md
Created October 7, 2017 08:53
Notes from Map Camp 2017

Maps

Liam Maxwell

  • Gov must move silos -> platforms
  • Introduction of open standards and data
  • Coding in the open means sharing
  • Common standards means common tools
  • Outcome based teams
  • Change needs spend controls
  • Square of despair: procurement, security, legacy, capability
@pgchamberlin
pgchamberlin / chintz-tooling.md
Last active April 19, 2017 22:03
Chintz: tooling for technology agnostic design systems

Chintz: tooling for technology agnostic design systems

I've been developing a system called Chintz for working with technology-agnostic design systems and pattern libraries. The idea is that you should be able to create web components in a library, and that they can then be directly used in websites built in any language or framework.

Technology agnosticism

If you've been following the hotness then you'll know that everything is written in JSX these days so get over it, but if you've also been around a while you might have noticed that new hot things come and go. New things are often great improvements, but however great they are they tend to be usurped sooner or later by something even better.

Brad Frost's post Managing technology-agnostic design systems describes a systematic solution. The idea is to have a design tier of components, which are converted for each flavour of tech

@pgchamberlin
pgchamberlin / cli53_import_zone_file.md
Created November 17, 2016 17:36
Replace a zone file to AWS Route53 using cli53

Replace a zone file in AWS Route53 using cli53

cli53 is a command line tool for Amazon Route53 and it's well documented.

Basic syntax to replace a BIND zone file is very simple:

cli53 import --file zonefile.txt --replace example.com
@pgchamberlin
pgchamberlin / keycloak_aws_deployment.md
Last active May 19, 2022 12:17
Deploying Keycloak to AWS using a Ubuntu AMI

Deploying Keycloak to AWS

The objective of this guide is to deploy Keycloak to AWS in a minimally complex way for testing and discovery purposes. This means using the standalone build of Keycloak backed with Hibernate H2. The result is not a production ready system. It won't scale, it won't survive significant load, it can't be clustered.

Mostly this Gist is a distillation of the Keycloak Server Installation guide for a specific use case: to spin up a quick and dirty Keycloak instance for testing and experimenting.

Steps

  • Spin up and configure a Ubuntu AMI
  • Install and configure Keycloak with an SSL cert
@pgchamberlin
pgchamberlin / ilabcode2_1.py
Created June 30, 2014 14:18
Dev on AWS: Lab 2.1 code
import boto
from boto.s3.key import Key
class Ilabcode:
def create_bucket(self, s3_client, bucket_name, region):
pass
def put_object(self, s3_client, bucket_name, source_file_name, object_key):
pass
@pgchamberlin
pgchamberlin / vim_browse
Last active August 29, 2015 14:02
Vim command to open file in Chrome
# Open the current file in Chrome in OSX from Vim
# Add this to ~/.vimrc
# Usage: `:Browse`
command Browse execute "!/usr/bin/open -a \"/Applications/Google Chrome.app\"" expand('%:p')
@pgchamberlin
pgchamberlin / gist:10633516
Created April 14, 2014 09:53
Jasmine data provider helper
//Data provider functionality in jasmine
//see http://blog.jphpsf.com/2012/08/30/drying-up-your-javascript-jasmine-tests
function using(name, values, func){
for (var i = 0, count = values.length; i < count; i++) {
if (Object.prototype.toString.call(values[i]) !== '[object Array]') {
values[i] = [values[i]];
}
func.apply(this, values[i]);
jasmine.currentEnv_.currentSpec.description += ' (with "' + name + '" using ' + values[i].join(', ') + ')';
}
@pgchamberlin
pgchamberlin / gist:9619843
Last active August 29, 2015 13:57
Functional vs procedural loops in PHP
class someclass
{
private $items;
function filterItemsUsingForeach()
{
$criterion = 'somevalue';
$items = array();
foreach ($this->items as $item) {
if (method_exists($item, 'someMethod') && $item->someMethod() == $criterion) {