Skip to content

Instantly share code, notes, and snippets.

@ricfeatherstone
ricfeatherstone / s3_test.go
Created January 11, 2022 10:27
Go test S3 using testcontainers and localstack
package s3
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/magiconair/properties/assert"
"github.com/testcontainers/testcontainers-go"

Keybase proof

I hereby claim:

  • I am ricfeatherstone on github.
  • I am ricfeatherstone (https://keybase.io/ricfeatherstone) on keybase.
  • I have a public key ASDoCXDi862nYL9TFsUc3LeyqEcUve-HzbkQWAXt5T5z_wo

To claim this, I am signing this object:

echo | openssl s_client -showcerts -connect <host>:<port> 2>/dev/null | openssl x509 -inform pem -noout -text
@ricfeatherstone
ricfeatherstone / show_docker_environment
Created March 30, 2016 08:31
Check Docker Environment
systemctl show docker --property Environment
@ricfeatherstone
ricfeatherstone / enable-rhel-server-extras.py
Created February 2, 2016 12:35
Enable rhel-server-extras repository in AWS
#!/usr/bin/python
from __future__ import print_function
import fileinput
in_start_extras_section = False
for line in fileinput.input("/etc/yum.repos.d/redhat-rhui.repo", inplace=True):
if line.find("[rhui-REGION-rhel-server-extras]") != -1:
in_start_extras_section = True
@ricfeatherstone
ricfeatherstone / refresh_aws_credentials
Created June 18, 2015 08:58
Update ~/.aws/credentials file when using IAM roles on EC2 instance.
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'json'
iam_info_uri = URI 'http://169.254.169.254/latest/meta-data/iam/info'
iam_info_response = Net::HTTP.get_response(iam_info_uri)
iam_info = JSON.parse(iam_info_response.body)
profile_name = iam_info['InstanceProfileArn'].split('/')[1]
#!/bin/bash
config=$(gdisk /dev/xvda <<EOF
p
q
EOF
)
disk_guid=$(echo $config | awk '{print($45)}')
@ricfeatherstone
ricfeatherstone / expand_mounted_partition
Created June 10, 2015 13:34
Automate expanding a mounted partition
#!/bin/bash
dir=$1
device=$2
partition=$3
start=$4
end=$5
umount /$dir
parted /dev/$device <<EOF
= MotoGp Graph Gist
These queries are my first attempts at Cypher and using Neo4j, I am just begining my journey so if you can identify ways to improve the queries then please post a comment to help me improve.
OK with that out of the way where did I begin? I love bike racing and thought the interrelated domains of championships, circuits, riders and teams would be a great place to start. I thought it would be cool to come up with a model that allowed to me to extrapolate bizarre facts from this years MotoGP championship (just in case anyone asked me to commentate on a upcoming race).
What sort of facts would I want to dazzle people with?
* What is the total race distance for the year?
* Which is the longest race?
//console
//setup
//hide
[source,cypher]
----
CREATE (losail:Circuit {name:'Losail', length:'5.380', width:'12'}),
(losail)-[:STARTS_AT]->(sf:Point {name:'Start/Finish'}),