Skip to content

Instantly share code, notes, and snippets.

View rbramwell's full-sized avatar
🚀
Blazing a trail the likes of which has never been seen.

Rory Bramwell rbramwell

🚀
Blazing a trail the likes of which has never been seen.
View GitHub Profile
@rbramwell
rbramwell / README.md
Created July 17, 2016 16:14 — forked from alexcasalboni/README.md
Google Vision API Examples - FACE DETECTION
# Author: Aram Grigorian <aram@opendns.com>
# https://github.com/aramg
# https://github.com/opendns
#
# By default, nginx will close upstream connections after every request.
# The upstream-keepalive module tries to remedy this by keeping a certain minimum number of
# persistent connections open at all times to upstreams. These connections are re-used for
# all requests, regardless of downstream connection source. There are options available
# for load balacing clients to the same upstreams more consistently.
# This is all designed around the reverse proxy case, which is nginxs main purpose.
@rbramwell
rbramwell / gist:f9eed8efb0e8dc36796f17c4a58b4c54
Created August 14, 2016 14:48 — forked from learncodeacademy/gist:ebba574fc3f438c851ae
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {
@rbramwell
rbramwell / list_latest_ecs_ami.sh
Created August 23, 2016 16:11 — forked from pahud/list_latest_ecs_ami.sh
get latest 3 amazon-ecs-optimized amzn-ami with AWS-CLI and JMESPath Query
$ aws --region ap-northeast-1 ec2 describe-images --owner amazon --query 'Images[?Name!=`null`]|[?contains(Name, `ecs-optimized`) == `true`]|[?contains(Name, to_string(`2016`)) == `true`]|[0:3].[Name,ImageId,CreationDate,Description]' --output text | sort -rk1
amzn-ami-2016.03.g-amazon-ecs-optimized ami-058a4964 2016-08-11T22:26:29.000Z Amazon Linux AMI 2016.03.g x86_64 ECS HVM GP2
amzn-ami-2016.03.e-amazon-ecs-optimized ami-2b08f44a 2016-07-11T22:28:39.000Z Amazon Linux AMI 2016.03.e x86_64 ECS HVM GP2
amzn-ami-2016.03.c-amazon-ecs-optimized ami-095dbf68 2016-05-26T23:32:34.000Z Amazon Linux AMI 2016.03.c x86_64 ECS HVM GP2
# or check the page http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html for latest AMI ID
@rbramwell
rbramwell / flap_nginx.py
Created August 30, 2016 22:37 — forked from alexlovelltroy/flap_nginx.py
Python can reload the nginx config file faster than I can write a new one
#!/usr/bin/env python
import time
import psutil
import os
import signal
@rbramwell
rbramwell / 0-README.md
Created August 31, 2016 18:00 — forked from alexcasalboni/0-README.md
AWS Lambda: Advanced Coding Session - clda.co/aws-lambda-webinar

AWS Lambda: Advanced Coding Session (slides)

Live demos:

  1. Amazon API Gateway Access Control
  2. Amazon Kinesis Streams processing
  3. Amazon Cognito Sync trigger
  4. AWS CloudFormation Custom Resources
@rbramwell
rbramwell / zotero-libreoffice.md
Created September 24, 2016 14:36 — forked from zuphilip/zotero-libreoffice.md
Zotero in Word/LibreOffice

It seems essential to use a 32-bit Java version and not 64-bit Java version for the LibreOffice integration of Zotero. However, it is possible to install several Java version on the same machine and to choose in LibreOffice one version to use (Tools-->Options-->Advanced):

Choose Java version in LibreOffice

Windows

On Windows 10 with LibreOffice 5 the autoinstaller does not work. Thus, one has to manually install

# Add a domain user to a remote server local group, if your current user has admin over the remote machine
powershell -c ([ADSI]'WinNT://SERVER/Administrators,group').add('WinNT://DOMAIN/USER,user')
# Get all local groups on a remote server
powershell -c "([ADSI]'WinNT://SERVER,computer').psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach { ($_.name)[0]}"
# Find members of the local Administrators group on a remote server
powershell -c "$([ADSI]'WinNT://SERVER/Administrators,group').psbase.Invoke('Members') | foreach { $_.GetType().InvokeMember('ADspath', 'GetProperty', $null, $_, $null).Replace('WinNT://', '') }"
# Enable the local Administrator account on a remote server
@rbramwell
rbramwell / Idempotent migration in MySQL example
Created February 2, 2017 23:33 — forked from jeremyjarrell/Idempotent migration in MySQL example
In MySQL, IF statements cannot exist outside of stored procedures. Therefore, to create an idempotent migration for MySQL it's necessary to wrap the migration in a stored procedure and execute that stored procedure against the database to perform the migration.
DELIMITER $$
DROP PROCEDURE IF EXISTS add_email_address_column_to_customers_table $$
-- Create the stored procedure to perform the migration
CREATE PROCEDURE add_email_address_column_to_customers_table()
BEGIN
-- Add the email_address column to the customers table, if it doesn't already exist