We'll assume an OS X Mavericks (10.9) box here.
You'll need:
- Vagrant
- Vagrant's VMware Fusion provider
#!/usr/bin/env bash | |
# Install missing Linux From Scratch Host System Requirements for Ubuntu 14.04 | |
if [ ! $(whoami) == "root" ]; then | |
echo "Please run as root!" | |
exit 1 | |
fi | |
# symlink sh to bash | |
ln -fsv /bin/bash /bin/sh |
#!/usr/bin/python | |
''' Python command line argument example using argparse module | |
Example output: | |
./parser.py --server=pyserver --port=8080,443,25,22,21 --keyword=pyisgood | |
Server name: [ pyserver ] |
sudo -i
and type in your Mac Administrator account password. sudo
gives you root level or administrator level privileges.dsconfigad -show
rsync (Everyone seems to like -z, but it is much slower for me)
#!/bin/bash | |
#attach the EBS to /dev/sdf before running it | |
#format EBS | |
mkfs -t ext4 /dev/xvdf | |
#copy original /var to /dev/xvdf | |
mkdir /mnt/new | |
mount /dev/xvdf /mnt/new | |
cd /var |
import paramiko | |
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem") | |
c = paramiko.SSHClient() | |
c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
print "connecting" | |
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k ) | |
print "connected" | |
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ] | |
for command in commands: | |
print "Executing {}".format( command ) |
A bit hackish so far. Be sure to read:
cfg.parser () { | |
fixed_file=$(cat $1 | sed 's/ = /=/g') # fix ' = ' to be '=' | |
IFS=$'\n' && ini=( $fixed_file ) # convert to line-array | |
ini=( ${ini[*]//;*/} ) # remove comments | |
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix | |
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1) | |
ini=( ${ini[*]/=/=\( } ) # convert item to array | |
ini=( ${ini[*]/%/ \)} ) # close array parenthesis | |
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2) | |
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis |
require 'rubygems' | |
require 'mechanize' | |
MAX_PAGES = 6 | |
def each_google_result_page(query, max_pages=MAX_PAGES) | |
i = 0 | |
a = Mechanize.new do |a| | |
a.get('http://google.com/') do |page| | |
search_result = page.form_with(:name => 'f') do |search| |