Skip to content

Instantly share code, notes, and snippets.

View greyhoundforty's full-sized avatar
🏠
Working from home

Ryan Tiffany greyhoundforty

🏠
Working from home
View GitHub Profile
@greyhoundforty
greyhoundforty / standardLbPriceId.py
Created April 15, 2016 14:22
Get the standard (location agnostic) itemPriceId for Local Load Balancers
import SoftLayer
import json
object_filter = {
'items': {
'prices': {
'locationGroupId': {
'operation': 'is null'
}
}
@greyhoundforty
greyhoundforty / orderLb.py
Created April 15, 2016 14:24
Order a SoftLayer Local Load Balancer
"""
Order a load balancer
Important manual pages:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Product_Item_Price
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder
License: http://sldn.softlayer.com/article/License
@greyhoundforty
greyhoundforty / cores.md
Created April 22, 2016 18:40
How to use sed with this file

So I have this file in my server

#cloud-config
coreos:
  etcd2:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
    discovery: "https://discovery.etcd.io/dd44e33e024fc8bddd309af7a88dcb50"
    # multi-region and multi-cloud deployments need to use $public_ipv4
 advertise-client-urls: "http://$public_ipv4:2379"
@greyhoundforty
greyhoundforty / qn.sh
Created July 7, 2016 14:53
Function using geeknote to quickly capture data and send it to Evernote
qn () {
geeknote create --content "$2" --notebook Unsorted --title "$1"
}
@greyhoundforty
greyhoundforty / esclick.py
Created September 30, 2016 20:37
Search Elasticsearch data
#!/usr/bin/env python
import json
import click
import elasticsearch
@click.command()
@click.argument('query', required=True)
@greyhoundforty
greyhoundforty / vsitesting.md
Created November 4, 2016 15:56
VSI testing

How to tell if a VSI is on a Public or Private node

Use the SoftLayer_Virtual_Guest service with the getObject method and look for dedicatedAccountHostOnlyFlag. In the following example the response from the API is true which means this is a Private Node VSI.

curl -s --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" "https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/GUEST_ID/getObject?objectMask=mask\[dedicatedAccountHostOnlyFlag\]

{"dedicatedAccountHostOnlyFlag":true}%

How to tell if a VSI is using SAN or Local Storage

@greyhoundforty
greyhoundforty / migrate.md
Created November 4, 2016 20:48
Migrating a VSI from SAN to Local storage

Migrating a VSI from SAN to Local storage

Example CURL:

curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -X POST --data @migrate.json
https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

Input JSON:

@greyhoundforty
greyhoundforty / orderHourly.py
Created November 10, 2016 17:25
Hourly Bare Metal Order
import SoftLayer
from pprint import pprint as pp
slClient = SoftLayer.Client()
hw = { 'datacenter':
{'name': 'DATACENTER'},
'hostname': 'HOSTNAME',
'domain': 'DOMAIN',
'hourlyBillingFlag': True,
@greyhoundforty
greyhoundforty / csd-wrapper.sh
Created December 2, 2016 15:52
Cisco Wrapper for OSX openconnect
#!/bin/bash
# Cisco Anyconnect CSD wrapper for OpenConnect
# Enter your vpn host here
CSD_HOSTNAME=dal09.remote.softlayer.com
if [[ -z ${CSD_HOSTNAME} ]]
then
echo "Define CSD_HOSTNAME with vpn-host in script text. Exiting."
exit 1
fi
@greyhoundforty
greyhoundforty / install.sh
Last active December 7, 2016 19:34
Array Install File edited for use with Sierra
#!/bin/sh
curr_dir="."
cs_dir="$HOME/array_cs"
if [ $# -eq 1 ]; then
curr_dir=$1
else
echo "use default directory"
fi