Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@jonathanhle
jonathanhle / README.md
Created June 25, 2019 20:22 — forked from joelthompson/README.md
Vault Auth
@jonathanhle
jonathanhle / lambda-function-xray-enablement.tf
Created July 9, 2019 20:11 — forked from mdlavin/lambda-function-xray-enablement.tf
Terraform configuration to enable X-Ray for a Lambda function
resource "aws_lambda_function" "service" {
# Your usual aws_lambda_function configuration settings here
tracing_config {
mode = "Active"
}
}
@jonathanhle
jonathanhle / gh-dl-release
Created December 14, 2019 00:30 — forked from maxim/gh-dl-release
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@jonathanhle
jonathanhle / get_instance_tag_with_instance_id.py
Created April 9, 2020 03:35 — forked from sidja/get_instance_tag_with_instance_id.py
Using Python and Boto3 to get Instance Tag information with instance id
import boto3
def get_instance_name(fid):
"""
When given an instance ID as str e.g. 'i-1234567', return the instance 'Name' from the name tag.
:param fid:
:return:
"""
ec2 = boto3.resource('ec2')
ec2instance = ec2.Instance(fid)
@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

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
#!/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 / 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.
@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