Skip to content

Instantly share code, notes, and snippets.

💻
Building something amazing

Mark Richman mrichman

💻
Building something amazing
Block or report user

Report or block mrichman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrichman
mrichman / simple-https-server.py
Created Oct 25, 2019
Simple HTTPS Server in Python
View simple-https-server.py
#!/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 Apr 11, 2019
Blog Post: Scheduling DynamoDB Backups with Lambda, Python, and Boto3
View lambda_function.py
import datetime
import boto3
MAX_BACKUPS = 3
dynamo = boto3.client('dynamodb')
def lambda_handler(event, context):
@mrichman
mrichman / Brewfile
Created Mar 25, 2019
brew bundle dump
View Brewfile
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 Oct 31, 2018
Lambda Function to Create SSM Parameters using SecureString
View create-params.py
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 Jul 17, 2018
Beat up your CPU for 10 seconds
View main.go
package main
import (
"runtime"
"time"
)
func main() {
n := runtime.NumCPU()
runtime.GOMAXPROCS(n)
@mrichman
mrichman / brake.rb
Last active Jun 20, 2018
Batch convert videos into MP4 format using HandBrakeCLI
View brake.rb
#!/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 Dec 7, 2019
Bootstrap script for setting up a new OSX machine
View osx_bootstrap.sh
#!/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 Nov 30, 2017
View thumbprint of AWS keypair (*.pem)
View gist:61dc568f1a4b8356514d0174bc37c6eb
openssl pkcs8 -in aws-keypair.pem -nocrypt -topk8 -outform DER | openssl sha1 -c
@mrichman
mrichman / Export-ModuleDocumentation.ps1
Last active Sep 19, 2017
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.
View Export-ModuleDocumentation.ps1
#requires -module platyPS
<#
.SYNOPSIS
Export a module's documentation in markdown.
.DESCRIPTION
Export a module's documentation in markdown.
@mrichman
mrichman / README.md
Created Aug 18, 2017
Install delve debugger on Mac OS X without homebrew
View README.md

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
You can’t perform that action at this time.