Skip to content

Instantly share code, notes, and snippets.

View mrichman's full-sized avatar

Mark Richman mrichman

View GitHub Profile
@mrichman
mrichman / simple-https-server.py
Created October 25, 2019 11:55
Simple HTTPS Server in Python
#!/usr/bin/env python3
"""
generate server.pem:
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
@mrichman
mrichman / lambda_function.py
Created April 11, 2019 18:14
Blog Post: Scheduling DynamoDB Backups with Lambda, Python, and Boto3
import datetime
import boto3
MAX_BACKUPS = 3
dynamo = boto3.client('dynamodb')
def lambda_handler(event, context):
@mrichman
mrichman / Brewfile
Created March 25, 2019 21:28
brew bundle dump
tap "aws/tap"
tap "buo/cask-upgrade"
tap "cjbassi/gotop"
tap "garethr/kubeval"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
@mrichman
mrichman / create-params.py
Created October 31, 2018 13:52
Lambda Function to Create SSM Parameters using SecureString
import boto3
import json
from botocore.vendored import requests
def lambda_handler(event, context):
kms_client = boto3.client('kms')
ssm_client = boto3.client('ssm')
@mrichman
mrichman / main.go
Created July 17, 2018 12:28
Beat up your CPU for 10 seconds
package main
import (
"runtime"
"time"
)
func main() {
n := runtime.NumCPU()
runtime.GOMAXPROCS(n)
@mrichman
mrichman / brake.rb
Last active June 20, 2018 14:41
Batch convert videos into MP4 format using HandBrakeCLI
#!/usr/bin/env ruby
require 'optparse'
# Default options
options = {
verbose: false,
preset: "Fast 1080p30"
}
OptionParser.new do |opt|
@mrichman
mrichman / osx_bootstrap.sh
Last active November 14, 2024 19:40
Bootstrap script for setting up a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@mrichman
mrichman / gist:61dc568f1a4b8356514d0174bc37c6eb
Created November 30, 2017 22:48
View thumbprint of AWS keypair (*.pem)
openssl pkcs8 -in aws-keypair.pem -nocrypt -topk8 -outform DER | openssl sha1 -c
@mrichman
mrichman / Export-ModuleDocumentation.ps1
Last active September 19, 2017 14:02
Export a PowerShell module's documentation in Markdown format. Files written to temp directory as "<Module>Documentation". The platyPS module can be installed via PowerShell Gallery: Install-Module -Name platyPS.
#requires -module platyPS
<#
.SYNOPSIS
Export a module's documentation in markdown.
.DESCRIPTION
Export a module's documentation in markdown.
@mrichman
mrichman / README.md
Created August 18, 2017 12:17
Install delve debugger on Mac OS X without homebrew

Install delve debugger on Mac OS X without homebrew

mkdir $GOPATH/src/github.com/derekparker
cd $GOPATH/src/github.com/derekparker
git clone https://github.com/derekparker/delve.git
cd delve
CERT=dlv-cert make install