Skip to content

Instantly share code, notes, and snippets.

View consolewitch's full-sized avatar

Steppin' Razor consolewitch

View GitHub Profile
@consolewitch
consolewitch / gist:43f75c24d6a3a35d797e
Created January 11, 2016 06:05
onename verification
Verifying that +terminal is my blockchain ID. https://onename.com/terminal
@consolewitch
consolewitch / disableRoaming.command
Last active January 15, 2016 08:14
OSX GUI executable script to fix CVE-2016-0777 vulnerability
#!/bin/bash
echo ==========================================================================
echo This will disable openSSH roaming for your user
echo ==========================================================================
echo
ssh -v -T -o StrictHostKeyChecking=no git@github.com 2>&1 | grep Roaming
if [ $? == '0' ]
then
cat <<EOM >>~/.ssh/config
#

Keybase proof

I hereby claim:

  • I am logicalmethods on github.
  • I am terminal (https://keybase.io/terminal) on keybase.
  • I have a public key whose fingerprint is 7954 CEE3 6B5F DA17 29BC B6BD E611 7099 7FD7 58FA

To claim this, I am signing this object:

@consolewitch
consolewitch / bake_ami.yml
Created June 1, 2017 01:36
A skeleton for provisioning windows instances and then baking them into new AMIs through a firewall in AWS
---
# This is a stripped version of some code I wrote to bake windows AMIs with ansible through a bastion.
# It works but may need some coaxing if you are going to use it. It was a work-in-progress when we
# realized that we didn't need to do this for unrelated reasons. YMMV ~Alex
- name: "Start base image"
hosts: localhost
gather_facts: False
connection: local
vars:
@consolewitch
consolewitch / untangle_s3.py
Created June 20, 2017 19:16
untangle files that have been accidentally overwritten in a versioning-enabled s3 bucket
# this code will untangle files that have been accidentally overwritten in a versioning-enabled s3 bucket
# contact Terminal@SneakSneak.Org for assistance
import boto.s3.connection, sys
from collections import defaultdict
accessKey="XXXXXXXX/XXXXXX.XXXX"
secretKey="XXXXXXX/XXXXXXXXXXX.XXXXXXXXX.XXXXXXXXXX"
srcKeyPrefix="path/to/key" #no leading or trailing slash
srcBucket="destination-bucket-name-here"
@consolewitch
consolewitch / get_eth_device_from_adapter_number.sh
Last active April 3, 2018 17:26
get_eth_device_from_adapter_number.sh
#! /bin/bash
###
# Written by Alex N. Speaks
# Takes the position in which a NIC appears in the vmware console as an argument.
# Returns the ethernet device name that corresponds to that position number.
# Position numbers start at 0
# You can think of this as the old-style ethX number
NIC_INDEX=$1
@consolewitch
consolewitch / deploy_k8s_manifests.yaml
Last active May 18, 2018 18:37
deploy Kubernetes manifests with ansible (broken)
# This is *a* way to deploy kubernetes manifests with ansible but it doesn't currently work very well..
# the python library that ansible uses to call kubernetes isn't up to date. See the following link for details
# https://github.com/ansible/ansible/issues/36676#event-1510125400
#- name: "install requirements for ansible k8s_raw module"
# pip:
# name: "{{ item.name }}"
# version: "{{ item.version }}"
# state: present with_items:
# - { name: "openshift", version: "0.5.0" }
@consolewitch
consolewitch / var_rename.py3
Last active June 7, 2018 00:54
In a shell / ansible / packer stack find and replace var names.
import re
import fileinput
import sys
old_caps_underscored_var=sys.argv[1]
old_lower_underscored_var=old_caps_underscored_var.lower()
old_lower_dashed_var=old_lower_underscored_var.replace("_","-")
new_caps_underscored_var=sys.argv[2]
new_lower_underscored_var=new_caps_underscored_var.lower()
@consolewitch
consolewitch / main.yaml
Created July 17, 2018 22:18
ansible role (tasks/main.yaml) to install k8s on an ubuntu server.
---
- name: "Disable swap"
command: "swapoff -a"
- name: "Remove swap from fstab"
lineinfile:
path: /etc/fstab
state: absent
regexp: '^.*(\t| )swap(\t| )sw(\t| ).*$'
@consolewitch
consolewitch / mongo-entrypoint.sh
Last active March 25, 2019 20:26
A really stupid entrypoint script from the mongo docker container version 3.2.3
#!/bin/bash
set -e
# if parameters that start with '-' were passed to the script via the CMD directive then concat
# them to the string 'mongod'
if [ "${1:0:1}" = '-' ]; then
set -- mongod "$@"
fi
# if the last conditional statement was triggered or if we're running without any parameters