Skip to content

Instantly share code, notes, and snippets.

View nicholasjackson's full-sized avatar
📺
UToobin, Like and Subscribe

Nicholas Jackson nicholasjackson

📺
UToobin, Like and Subscribe
View GitHub Profile
@nicholasjackson
nicholasjackson / gist:963449
Created May 9, 2011 21:26
How to Draw with Touches
#pragma mark<Touch Methods>
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch tapCount] == 2) {
drawImage.image = nil;
return;
}
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
<polymer-element name="my-element">
<template>
@nicholasjackson
nicholasjackson / MessageManager.java
Created May 8, 2015 20:58
Fix for race condition
package com.njackson.pebble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.getpebble.android.kit.PebbleKit;

Keybase proof

I hereby claim:

  • I am nicholasjackson on github.
  • I am nicjackson (https://keybase.io/nicjackson) on keybase.
  • I have a public key whose fingerprint is F573 28B1 1095 5739 3CCC 4240 2CD2 E635 F441 E5E4

To claim this, I am signing this object:

black = '#3b4252';
red = '#bf616a'; // red
green = '#a3be8c'; // green
yellow = '#ebcb8b'; // yellow
blue = '#81a1c1'; // blue
magenta = '#b48ead'; // pink
cyan = '#88c0d0'; // cyan
white = '#e5e9f0'; // light gray
lightBlack = '#4c566a'; // medium gray
lightRed = '#bf616a'; // red
@nicholasjackson
nicholasjackson / main.go
Last active March 14, 2017 13:58
Generate Self Signed Intermediate Cert with Elliptical Curve
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha1"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
@nicholasjackson
nicholasjackson / nameserver.tf
Created August 10, 2017 10:38
Terraform snippet to change nameservers in AWS Route53 domain
data "aws_route53_zone" "selected" {
name = "demo.gs."
private_zone = false
}
resource "aws_route53_record" "ns" {
zone_id = "${data.aws_route53_zone.selected.zone_id}"
name = "${data.aws_route53_zone.selected.name}"
type = "NS"
ttl = "300"
@nicholasjackson
nicholasjackson / fail_aws_invalid_region.json
Last active January 8, 2018 18:20
Example Sentinel Policy for restring AWS region to environment
{
"mock": {
"tfplan": {
"config": {
"providers": [
{
"type": "aws",
"config": {"region": "something else"}
}
]
@nicholasjackson
nicholasjackson / message_protocol.md
Last active January 23, 2018 12:17
Generic message protocol for OpenFaaS Afterburner

Generic message protocol for OpenFaaS Afterburner

Implementing HTTP request parsing is problematic for Afterburner functions, and requires a full implementation of the HTTP RFC for each request to ensure compliance with the standard.

This proposal sets out an example of a simple text based protocol which is language agnostic, off-loading the parsing of the request to the watchdog not the function handler.

Message format

[HEADER required] \r\n [BODY optional] 0\r\n\r\n
@nicholasjackson
nicholasjackson / Untitled-1
Created October 10, 2018 16:54
Example using Consul Connect and Nginx
# Consul connect and Nginx
## Example docker compose
```yaml
nginx:
image: nginx:latest
volumes:
- ./docker-compose-nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8181:80"