Skip to content

Instantly share code, notes, and snippets.

View cpswan's full-sized avatar
🏡

Chris Swan cpswan

🏡
View GitHub Profile
@cpswan
cpswan / gcutil --help
Last active December 19, 2015 19:59
gcutil --help (version 1.8.2)
Command line tool for interacting with Google Compute Engine.
Please refer to http://developers.google.com/compute/docs/gcutil/tips for more
information about gcutil usage.
USAGE: gcutil [--global_flags] <command> [--command_flags] [args]
@cpswan
cpswan / gcutil help
Last active December 20, 2015 04:38
gcutil help (version 1.8.2)
Command line tool for interacting with Google Compute Engine.
Please refer to http://developers.google.com/compute/docs/gcutil/tips for more
information about gcutil usage.
USAGE: gcutil [--global_flags] <command> [--command_flags] [args]
Any of the following commands:
@cpswan
cpswan / es3client cmds
Created July 24, 2013 18:49
es3client commands and arguments
Available commands (grouped by type):
Base images:
create_base_image
delete_base_image
desc_base_images
Bundles:
add_content_to_bundle
create_bundle
delete_bundle
delete_content_from_bundle
@cpswan
cpswan / vm_time_sync.sh
Created December 24, 2015 16:29
Sync time between Ubuntu VM and VMware host
sudo apt-get install -y open-vm-tools
vmware-toolbox-cmd timesync enable
@cpswan
cpswan / clientpack.sh
Last active February 5, 2016 16:01
Get a VNS3 clientpack
#!/bin/bash
command -v openvpn >/dev/null 2>&1 || { echo "OpenVPN should be installed first. Aborting." >&2; exit 1; }
command -v curl >/dev/null 2>&1 || { echo "This script requires curl, but it's not installed. Aborting." >&2; exit 1; }
MGRIP=10.0.0.10
APIPW=pa55Word
NAME=$1
if [ -e /etc/openvpn/clientpack.ip ]; then
echo "VNS3 Clientpack already installed"
else
CLIENTPACKJSON=`curl -k -X POST -u api:$APIPW -H 'Content-Type: application/json' https://$MGRIP:8000/api/clientpacks/next_available`
@cpswan
cpswan / cloud-localds
Last active December 29, 2016 18:44
cloud-localds from Ubuntu 13.04 - place in /usr/bin on older dists (e.g. 12.04)
#!/bin/bash
VERBOSITY=0
TEMP_D=""
DEF_DISK_FORMAT="raw"
DEF_FILESYSTEM="iso9660"
error() { echo "$@" 1>&2; }
errorp() { printf "$@" 1>&2; }
fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
@cpswan
cpswan / .screenrc
Created January 3, 2017 11:35
Keep shell/prompt when using screen (on Synology)
shell -$SHELL
@cpswan
cpswan / history
Created January 25, 2017 13:21
Bash history from Asus Tinker Board Debian image
ping www.google.com.tw
sudo ping www.google.com.tw
sudo apt-get update
df
cd Desktop/
ls
tar -zxvf ASUSTinkerBoard.gpio-0.1_20161025.tar.gz
cd ASUSTinkerBoard.gpio-0.1_20161025/
ls
cd ..
@cpswan
cpswan / IPsec_example.sh
Created July 23, 2015 20:46
VNS3 IPsec tunnel example
#!/bin/bash
# Set credentials and address for VNS3 manager
VNS3_PW=pa55Word
VNS3_IP=10.11.22.33
# Use IPsec connection 2
VNS3_EP=2
# Clear out any existing IPsec tunnels
while true; do
TUNNEL=$(curl -s -k -X GET -u api:"$VNS3_PW" \
https://"$VNS3_IP":8000/api/ipsec | python -mjson.tool \
@cpswan
cpswan / overlay-docker-systemd.sh
Created December 24, 2015 15:07
Configure systemd to use overlay file system for Docker
sudo mkdir /etc/systemd/system/docker.service.d
sudo bash -c 'cat <<EOF > /etc/systemd/system/docker.service.d/overlay.conf
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay
EOF'
sudo systemctl daemon-reload
sudo systemctl restart docker