Skip to content

Instantly share code, notes, and snippets.

@dwardu89
dwardu89 / lambda_function.py
Last active July 9, 2017 18:57
A skeleton for an AWS lambda function that will ultimately be used to output an Alexa skill.
'''
A skeleton for an AWS lambda function that will ultimately be used to output an
Alexa skill.
'''
def lambda_handler(event, context):
'''
Do work over here
'''

Keybase proof

I hereby claim:

  • I am dwardu89 on github.
  • I am dwardu (https://keybase.io/dwardu) on keybase.
  • I have a public key ASBGX5zIHiAggpLE1fNG5XhlETRr60ld63emdyfytP2QFgo

To claim this, I am signing this object:

'''
A python representation of a Trie data structure.
'''
class trie_node:
def __init__(self):
self.value = None
self.children = dict()
@dwardu89
dwardu89 / aws_s3_purge_versions.sh
Created February 14, 2018 10:22
Purging all the versions of objects from an AWS S3 bucket.
#!/bin/bash
# This script assumes that your aws cli is able to connect to the bucket you want to purge
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@dwardu89
dwardu89 / generate_random_password.sh
Created April 4, 2018 09:29
Generates a random password
#!/usr/bin/env bash
RANDOM_PASSWORD=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
echo $RANDOM_PASSWORD
@dwardu89
dwardu89 / createStorageTransferServiceJob.go
Created June 9, 2018 17:13
Creates a Storage Transfer Service request to sync objects form a Google Cloud Bucket to another Google Cloud Bucket
package main
import (
"golang.org/x/oauth2/google"
"google.golang.org/api/storagetransfer/v1"
"fmt"
"log"
"golang.org/x/net/context"
@dwardu89
dwardu89 / s3.tf
Created June 11, 2018 14:01 — forked from onnimonni/s3.tf
s3 replicated bucket with terraform
# Create all variables used in this Terraform run
variable "aws_access_key" {}
variable "aws_access_secret_key" {}
variable "aws_bucket_name" {}
variable "aws_region_main" {
default = "eu-west-1"
}
variable "aws_region_replica" {
default = "eu-central-1"
}
@dwardu89
dwardu89 / code-export-extensions.sh
Created February 25, 2020 09:32
Export a list of Visual Studio Code Extensions
#!/usr/bin/env bash
code --list-extensions | awk '{print "code --install-extension " $1}'
@dwardu89
dwardu89 / README.md
Created August 25, 2020 09:26 — forked from xandout/README.md
Kubernetes DaemonSet that enables a direct shell on each Node using SSH to localhost

Getting a shell on each node

I run several K8S cluster on EKS and by default do not setup inbound SSH to the nodes. Sometimes I need to get into each node to check things or run a one-off tool.

Rather than update my terraform, rebuild the launch templates and redeploy brand new nodes, I decided to use kubernetes to access each node directly.

Alternative option

https://github.com/alexei-led/nsenter