Skip to content

Instantly share code, notes, and snippets.

View mjhuber's full-sized avatar

Micah Huber mjhuber

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mjhuber on github.
  • I am huberm (https://keybase.io/huberm) on keybase.
  • I have a public key whose fingerprint is 3320 4F40 70D4 5634 7C6F 01AD 3A37 85C4 6AE7 5F3E

To claim this, I am signing this object:

@mjhuber
mjhuber / main.yml
Last active March 8, 2018 02:37
[Ansible with_subelement] #ansible
---
- hosts: localhost
gather_facts: no
vars:
families:
- surname: Smith
children:
- name: Mike
age: 4
- name: Kate
@mjhuber
mjhuber / docker-cleanup.service
Last active March 8, 2018 02:36
[docker-compose systems setup] #docker
[Unit]
Description=Docker cleanup
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
WorkingDirectory=/tmp
User=root
Group=root
@mjhuber
mjhuber / docker-compose.yaml
Last active April 30, 2019 07:18
[Traefik LetsEncrypt Example] #docker
version: '2'
services:
proxy:
image: traefik:latest
container_name: proxy
networks:
- frontend
restart: on-failure
ports:
@mjhuber
mjhuber / create-ipset-lists.sh
Last active March 8, 2018 03:04
Block Tor - Asuswrt Merlin
#!/bin/sh
# snbforums thread:
# https://www.snbforums.com/threads/country-blocking-script.36732/page-2#post-311407
# Re-download blocklist if locally saved blocklist is older than this many days
BLOCKLISTS_SAVE_DAYS=15
# For the users of mips routers (kernel 2.x): You can now block sources with IPv6 with country blocklists
# Enable if you want to add huge country IPv6 netmask lists directly into ip6tables rules.
# Also, enabling this will add a *lot* of processing time!
@mjhuber
mjhuber / trimDocker.sh
Last active April 4, 2018 19:34
kill docker containers > age
#!/bin/bash
/usr/bin/docker ps --format='{{.ID}}' | \
xargs -n 1 -r /usr/bin/docker inspect -f '{{.ID}} {{.State.Running}} {{.State.StartedAt}}' | \
awk '$2 == "true" && $3 <= "'$(date -d 'yesterday' -Ins --utc | sed 's/+0000/Z/')'" { print $1 }' | \
xargs -r /usr/bin/docker kill
@mjhuber
mjhuber / .ansible.cfg
Created July 10, 2018 19:35
speeding up ansible
[defaults]
forks = 20
internal_poll_interval = 0.001
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey
pipelining = true
@mjhuber
mjhuber / summary.md
Last active July 13, 2018 13:43
Testweb deployment to AWS

Technical Challenge: Webapp deployment to AWS

The application has been deployed with the provided AWS resources and is available to view at http://testweb-elb-2116775699.eu-central-1.elb.amazonaws.com

Requirements

A one line command that, when invoked, deploys a webapp.

  • App must be deployed to an EC2 instance in AWS
  • The default page of the webapp must be viewable by a URL provided as output to the command.
  • The webapp must not be a generic nginx or apache setup
  • Only spend 3 hours creating
@mjhuber
mjhuber / readme.md
Last active July 19, 2018 13:24
Easier openstack namespaces

Easier Openstack Namespaces:

  1. Put all your rc files in ~/openstack
  2. Add below to your .bashrc:
# openstack rc helper function
osns () {
	for i in $(env | grep OS | cut -d = -f 1) ; do unset $i ; done
	source "$(find ~/openstack/ -type f -name $@* | head -n 1)"
}
@mjhuber
mjhuber / app_a.travisci.txt
Last active August 3, 2018 14:46
Autoscaling Container Application
travis_fold:start:services
travis_time:start:14301690
$ sudo service docker start
start: Job is already running: docker
travis_time:end:14301690:start=1532301407880208255,finish=1532301407898748510,duration=18540255
travis_fold:end:services

travis_fold:start:git.checkout
travis_time:start:04f399a1