Skip to content

Instantly share code, notes, and snippets.

@justmiles
justmiles / ipa.tf
Last active September 9, 2022 06:06
Deploy FreeIPA in AWS using Terraform
# Notes:
# You'll need to update any references to 'module.vpc' with your VPC's info (subnets, security groups, etc)
# If you define your subnets as a map, this will deploy different replicas across availabity zones. Note
# that the master and first replica will be in the same AZ.
#
# Look through the 'connection' fields and update with your bastion_host/key combos
#
# Number of IPA Replica(s) to deploy
variable "ipa_replicas" {

Keybase proof

I hereby claim:

  • I am justmiles on github.
  • I am justmiles (https://keybase.io/justmiles) on keybase.
  • I have a public key ASB5yXtUoMAX9Mb01Vv1dSTI4H64EbU7QHyX_k93-nOoLQo

To claim this, I am signing this object:

@justmiles
justmiles / bootstrap.sh.tpl
Last active November 9, 2017 19:20
userdata chef bootstrap
#!/bin/bash -xev
# Install Dependencies
yum install -y unzip
# Install jq
[ -e /usr/bin/jq ] || $(curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/bin/jq \
&& chmod +x /usr/bin/jq)
# Set environment Variables
@justmiles
justmiles / purge-route53-zone.sh
Created November 2, 2018 16:15
deletes all records in a Route53 hosted zone saving a backup to your home directory
#!/bin/bash
#
# purge-route53-zone.sh
# deletes all records in a Route53 hosted zone
# saving a backup to your home directory
#
# Usage:
# purge-route53-zone.sh HOSTED_ZONE_ID
#
# Requirements:
#!/bin/bash
## Usage
# curl -sfLO https://gist.githubusercontent.com/justmiles/2e985f71f5aea743d7f1e61c38fc42d0/raw/64636aca2630ccc50c87db4520a8f226efa071a2/gather_info.sh
# chmod +x ./gather_info.sh
# sudo ./gather_info.sh
WORKDIR="info-$(hostname)-$(date +'%d-%m-%y')"
OUTPUT="${WORKDIR}/info.$(date +'%d-%m-%y').txt"
SCRIBE="${WORKDIR}/os-scribe.$(date +'%d-%m-%y').csv"
-- Unused Reservations
WITH reservations AS
(SELECT split_part(substr(line_item_usage_type, 12), '.',1) AS s3,
substr(line_item_usage_type,12) AS s4,
ROUND(SUM(line_item_blended_cost), 2) AS value
FROM "athenacurcfn_cost_reports"."cost_reports"
WHERE bill_billing_period_start_date BETWEEN TIMESTAMP '{{ date.start }}' AND TIMESTAMP '{{ date.end }}'
AND line_item_usage_account_id = '{{account}}'
AND line_item_line_item_type = 'RIFee'
AND product_product_name = 'Amazon Elastic Compute Cloud'
@justmiles
justmiles / mac.py
Last active August 19, 2020 10:24
OpenVPN post_auth MAC address check via JumpCloud
# OpenVPN Access Server MAC address checking post_auth script.
# Johan Draaisma
#
# This script can be used with LOCAL, PAM, LDAP, and RADIUS authentication.
# It adds an additional check when authentication is done through the VPN connection.
# It applies to all 3 connection profiles types (server-locked, user-locked, auto-login).
# Windows, Linux, and macOS will be reporting MAC addresses. However, Android and iOS
# devices will not, due to technical reasons. They will instead by reporting UUID. For
# simplicity and legacy reasons we will just call it MAC address from here on in, but
# it can be in theory any unique hardware-based string that the client reports to us.
@justmiles
justmiles / ssm.sh
Last active November 25, 2020 16:26
Launch console sessions using AWS Simple Systems Manager
#!/bin/bash
# ssm
# Launch console sessions using AWS Simple Systems Manager
# Requirements
# jq, aws-cli
# Usage
# ssm <instance name>
# ssm <instance id>
_ssm() {
#!/bin/bash
#
# aws-paginated
# usage: aws-paginated <any aws cli command>
# requirements: aws-cli, jq
#
function aws-paginated() {
AWS_CLI_COMMAND="${@}"
OUTPUT=$(mktemp)

Install v4l2loopback

git clone git@github.com:umlaeute/v4l2loopback.git make && sudo make install sudo depmod -a

turn it on

sudo modprobe v4l2loopback devices=1 max_buffers=2 exclusive_caps=1 card_label="VirtualCam #0"

Install OBS

..