Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
import boto3
import timeit
region = 'us-east-1'
instances = ['i-0d1044d1adfasdasda']
ec2_client = boto3.client('ec2', region_name=region)
waiter_stop = ec2_client.get_waiter('instance_stopped')
waiter_okay = ec2_client.get_waiter('instance_status_ok')
@jonathanhle
jonathanhle / list.txt
Created September 10, 2020 19:54 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
@jonathanhle
jonathanhle / dynamodb.md
Created August 14, 2020 12:48 — forked from jlafon/dynamodb.md
An Introduction to Amazon's DynamoDB

An introduction to DynamoDB

DynamoDB is a powerful, fully managed, low latency, NoSQL database service provided by Amazon. DynamoDB allows you to pay for dedicated throughput, with predictable performance for "any level of request traffic". Scalability is handled for you, and data is replicated across multiple availability zones automatically. Amazon handles all of the pain points associated with managing a distributed datastore for you, including replication, load balancing, provisioning, and backups. All that is left is for you to take your data, and its access patterns, and make it work in the denormalized world of NoSQL.

Modeling your data

The single most important part of using DynamoDB begins before you ever put data into it: designing the table(s) and keys. Keys (Amazon calls them primary keys) can be composed of one attribute, called a hash key, or a compound key called the hash and range key. The key is used to uniquely identify an item in a table. The choice of the primary key is particularl

@jonathanhle
jonathanhle / Manual Terraform State Editing
Created July 31, 2020 06:51
Manual Terraform State Editing
From: https://github.com/hashicorp/terraform/issues/21499
Hi @im-dofoborh!
Manual changes can be made using the following workflow:
* terraform state pull >temp.tfstate
* edit temp.tfstate carefully as needed
* increment the integer in the top-level serial property so Terraform Cloud can see that the change was intentional
* terraform state push temp.tfstate
@jonathanhle
jonathanhle / aws_glacier_delete_vault.md
Created July 25, 2020 20:42 — forked from veuncent/aws_glacier_delete_vault.md
Delete all archives in an AWS Vault

AWS Glacier: Delete vault

Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.

Step 1 / Retrieve inventory

This will create a job that collects required information about the vault.

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME 
@jonathanhle
jonathanhle / ALTERNATIVES.adoc
Created July 11, 2020 00:35 — forked from mbbx6spp/ALTERNATIVES.adoc
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
#!/usr/bin/swift
import Foundation
let path = URL(fileURLWithPath: NSString(string: "~/Library/Application Support/.ffuserdata").expandingTildeInPath)
let data = try! NSData(contentsOf: path) as Data
let dictionary = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! NSDictionary
let mutableDictionary = dictionary.mutableCopy() as! NSMutableDictionary
for (key, value) in mutableDictionary {
@jonathanhle
jonathanhle / list splunk indexes
Created June 12, 2020 20:30
list all splunk indexes
| eventcount summarize=f index=* index=_* | dedup index | fields index

Install the netcat nc command with Homebrew (otherwise Mac OS X version is really old and the interface is different):

brew install netcat

Use netcat to listen for incoming TCP connections on port 3000:

nc -l -p 3000
@jonathanhle
jonathanhle / restart_bluetooth.sh
Created May 4, 2020 15:25 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport