Skip to content

Instantly share code, notes, and snippets.

@bunchc
bunchc / ubuntu-raid.seed
Last active May 26, 2018 14:12
Ubuntu preseed with raid support
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is meant to be used when installing Ubuntu
# from the ISO. The following menus will require user input, everything
# after will be an unattended install:
#
# * Select a language
---
# Install cgminer
- name: Installing cgminer with 2PAC support
hosts: miners
become: true
gather_facts: true
become_method: sudo
vars_files:
- vars/provision.yaml
@bunchc
bunchc / 10_update_windows
Last active February 12, 2018 18:39
Rename tmux / byobu windows to ssh hostname
#!/bin/bash
# for byobu, put this file in ~/.byobu/bin
# then chmod +x
# once that's done, every 10 seconds byobu will run this script
# and rename your windows to either the local host name, or to
# the host a windows is ssh'd into
for i in $(tmux list-windows -F '#{window_index}'); do {
panenames=$(tmux list-panes -t $i -F '#{pane_title}' | sed -e 's/:.*$//' -e 's/^.*@//' | uniq)
@bunchc
bunchc / customize.sh
Created January 17, 2018 20:25
Supporting files for packer-builder-arm-image
#!/bin/bash
set -x
# Localse, uncomment if user-data didn't fix these
export LANGUAGE=en_US.UTF-8; export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; locale-gen en_US.UTF-8
# Set locale to en_US.UTF-8
sudo cp /etc/locale.gen /etc/locale.gen.dist
sudo sed -i -e "/^[^#]/s/^/#/" -e "/en_US.UTF-8/s/^#//" /etc/locale.gen
@bunchc
bunchc / isroot.sh
Last active November 29, 2017 02:02
Root Password is blank, so set it maybe?
#!/bin/bash
#
# @description Attempt at checking for and mitigating #isroot
#
##
# Get macOS version
OS_Version=$(sudo system_profiler SPSoftwareDataType | grep "System Version" | cut -d : -f 2 | cut -d " " -f 3 | sed "s:.[[:digit:]]*.$::g")
is_root_enabled () {
@bunchc
bunchc / gist:a51bde9d95d6ae719584f3e278de6ff6
Last active September 22, 2017 19:32
Cinder hates me

user_variables.yml

## Cinder iscsi
cinder_iscsi_helper: tgtadm
cinder_iscsi_iotype: fileio
cinder_iscsi_num_targets: 100
cinder_iscsi_port: 3260

openstack_user_config.yml

@bunchc
bunchc / Do-TerribleThings.ps1
Last active May 26, 2018 14:08
Does terribad things to AD
$NewDomainName = "orangutan.local"
$NewDomainNetBios = "orangutan"
$NumRandomGroups = 12000
$NumRandomUsers = 24000
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
# Install chocolatey
Set-ExecutionPolicy AllSigned; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
@bunchc
bunchc / create_ssh_tunnel.sh
Created August 20, 2017 16:32
Script to create reverse SSH tunnel
#!/bin/bash
createTunnel() {
/usr/bin/ssh -N -R 2222:localhost:22 root@remoteaccess.isa.fuckingasshat.com
if [[ $? -eq 0 ]]; then
echo "Tunnel up!"
else
echo "No such luck, Mario. Princess is $?"
fi
}
@bunchc
bunchc / userdata-hardening-ufw
Created August 20, 2017 15:40
UserData Hardening script with UFW
#!/bin/bash
# user-data-hardening.sh
# Authors: Cody Bunch (bunchc@gmail.com)
#
# Script intended to be supplied as userdata to a cloud of some flavor.
# Enables some sane sysctl defaults, turns up iptables, and
# installs a HIDS / NIDS package
# Supply your email here
email_address="userdata@mailinator.com"
@bunchc
bunchc / easy_install-offline.md
Created August 2, 2017 03:30
(┛◉Д◉)┛彡┻━┻

pip install sometimes calls setup.py, which makes it ignore the offline params you specified for pip. To get around that, you need to create a file ~/.pydistutils.cfg

This will create said file:

echo -e '[easy_install]\nallow_hosts = 10.10.120.20\nfind_links = http://10.10.120.20/pypi/simple\nindex-url = http://10.10.120.20/pypi/simple' | tee ~/.pydistutils.cfg

The file looks like this: