Skip to content

Instantly share code, notes, and snippets.

View bortels's full-sized avatar

Tom Bortels bortels

View GitHub Profile
@bortels
bortels / gist:4653149
Created January 28, 2013 04:50
testing encoding
Abc > Def & Yow
@bortels
bortels / turtle_startup.lua
Created February 18, 2013 00:18
Startup Script for Computercraft Turtles
-- startup script for melee turtle
-- grabs a fresh copy of melee script on startup, then executes it
-- install with "pastebin get YBWf4qsN startup"
pastebinid = "UYwardhQ"
payload = "melee"
backup = payload .. ".bak"
print("Fetching " .. payload .. " program from pastebin")
if (fs.exists(backup)) then
@bortels
bortels / launchinstance
Created March 6, 2013 00:44
example script to create AWS ec2 instance using ruby sdk
#!/usr/bin/ruby
require 'rubygems'
require 'aws-sdk'
require 'erb'
aws_email="email address here"
aws_name="My Test Instance"
# below is IAM credentials for my account
@bortels
bortels / route53examples.rb
Created March 6, 2013 00:48
Experiments with aws ruby sdk for route53
#!/usr/bin/ruby
# Update route 53 DNS entry
require 'rubygems'
require 'aws-sdk'
AWS.config(YAML.load(File.read('credentials-file')))
zoneid = "unknown"
@bortels
bortels / install mitmproxy on AMI6
Last active December 17, 2015 18:39
Set up virtualenv on AMI6 RHEL for mitmproxy
# AWS AMI6 base setup for dev
cd
sudo yum -y update
# Prereqa for ruby/python
sudo yum -y groupinstall "Development Tools"
sudo yum -y install libxml2-devel zlib-devel openssl-devel libxslt libxslt-devel
sudo yum -y install readline-devel gdbm-devel bzip2-devel ncurses-devel sqlite-devel tk-devel
# mitmproxy requires Python 2.7+, but AMI6 only has 2.6.6, yay.
yum -y install wget
wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
@bortels
bortels / bootstrap apache
Last active December 17, 2015 18:39
Install Apache with mod_ssl on RHEL for AWS (AMI6 baseline)
sudo yum -y install httpd httpd-tools mod_ssl
sudo cat <<MODSSL >>/etc/httpd/conf/httpd.conf
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
<Directory /var/www/html>
AllowOverride All
</Directory>
DocumentRoot /var/www/html
@bortels
bortels / gist:7311859
Created November 5, 2013 00:31
powercli example
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $vmhost
= Get-VMHost -Name vortex10a.wlvdev.diginsite.com
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $s.Creat
eVM.VM | foreach { New-VM -VMHost $vmhost -Name $_.Name -DiskGB $_.HDDCapacity }
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
MyVM1 PoweredOff 1 0.250
New-VM : 11/4/2013 4:08:36 PM New-VM The operation for the entity
@bortels
bortels / openhtml5console.ps1
Created December 11, 2013 01:26
Open Remote VMWare Console in powershell
# Based on http://sourceforge.net/p/vghetto/code/HEAD/tree/scripts/generateHTML5VMConsole.pl#l54
# Requires Openssl - get it from http://www.openssl.org/related/binaries.html
$openssl = "C:\OpenSSL-Win64\bin\openssl.exe"
$vm = get-vm -name "canary"
# Get the session associated with the vcenter this VM is on. Ugly Hack.
# /VIServer=tbortels@dcacloudvc.diginsite.net:443/VirtualMachine=VirtualMachine-vm-804/
$uid = $vm.uid
@bortels
bortels / backupipad.pl
Created January 20, 2014 19:42
Backup my jailbroken iPad nightly to my unix box
#!/usr/bin/perl
# Backup ipad app Documents folders in a sane manner
# Expects public key login (ie. no password) as user "mobile"
$dest = '/backups/ipaddocs';
$find = 'find ./ -maxdepth 2 -name "*.app" -type d';
$appdir = '/private/var/mobile/Applications';
open (I, "ssh -n mobile\@192.168.1.86 'cd $appdir ; $find' |");
@bortels
bortels / addip.pl
Created January 27, 2014 20:55
Add Host Record (A and PTR) to infoblox via WAPI
#!/usr/bin/perl
# Add an IP to infoblox
# Note a valid login is required. You can use your own for testing, but for
# long term use, please request a svc_ service account for your script.
use LWP::UserAgent;
use JSON;
# We expect a fully-qualified DNS name and IP on the command line