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 / billing_rest.md
Created December 30, 2015 14:51
Billing API REST Examples

Before we begin I find it helpful to set some environment variables so that we don't have to provide our SoftLayer user and API key in every call. In your terminal run the following, substituting in your Portal username and API key:

export SOFTLAYER_USERNAME=<username>
export SOFTLAYER_API_KEY=<apikey>

How do I find out what my next bill will be?

@greyhoundforty
greyhoundforty / log_taskpaper_dayone.sh
Created December 30, 2015 20:42
Log @done taskpaper tasks to Day One and, archive the completed tasks and clear the archive
#!/usr/bin/env bash
grep '@done' ~/Dropbox/Listacular/weeklyschedule.taskpaper|tr -d \"\\t\" |/usr/local/bin/dayone new
/usr/bin/osascript ~/Library/Scripts/Applications/TaskPaper/move_to_archive.scpt
/usr/bin/osascript ~/Library/Scripts/Applications/TaskPaper/clear_archive.scpt
@greyhoundforty
greyhoundforty / bash_to_json.sh
Last active January 1, 2016 03:32
Simple script to test writing to json formatted file
## Simple script to test writing to json formatted file.
#!/bin/bash
# Get hostname
hostname=`hostname -A` 2> /dev/null
# Get distro
distro=`python -c 'import platform ; print platform.linux_distribution()[0] + " " + platform.linux_distribution()[1]'` 2> /dev/null
#!/bin/bash
# usage: $0 source_dir [source_dir] ...
# where source_dir args are directories containing git repositories
red="\033[00;31m"
green="\033[00;32m"
yellow="\033[00;33m"
blue="\033[00;34m"
purple="\033[00;35m"
#!/bin/bash
API="<PUSHBULLET API TOKE>"
MSG=`pwd`
# cd to repo and check if file needs to be added/commited
# if so then send pushbullet message
curl -u $API: https://api.pushbullet.com/v2/pushes -d type=note -d title="Git Dirs that need commits" -d body="$MSG"
@greyhoundforty
greyhoundforty / ObjectStorageUploader.sh
Last active January 7, 2016 19:20
Object Storage Upload bash script
#!/bin/bash
# ================================================================================
# ObjectStorageUploader.sh
# © Copyright IBM Corporation 2014.
# LICENSE: MIT (http://opensource.org/licenses/MIT)
# ================================================================================
#./objectstorageupload.sh dsl-4.4.10.iso 'myContainer/file.vhd' 'username' 'apikey'
fileToUpload=$1
@greyhoundforty
greyhoundforty / productidfrombilling.php
Created February 3, 2016 20:29
Get the product ID from a billing ID
I am trying to get the Product ID from the billing item ID and something here is not working.
```
ryan@galileo ~/php % php getbillingid.php
stdClass Object
(
[allowCancellationFlag] => 1
[cancellationDate] =>
[categoryCode] => guest_core
@greyhoundforty
greyhoundforty / Dockerfile
Created February 16, 2016 15:34
Dockefile for SSH container
# Use phusion/baseimage as base image. To make your builds reproducible, make
# sure you lock down to a specific version, not to `latest`!
# See https://github.com/phusion/baseimage-docker/blob/master/Changelog.md for
# a list of version numbers.
FROM phusion/baseimage:0.9.18
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# ...put your own build instructions here...
@greyhoundforty
greyhoundforty / getLBPrices.py
Created April 11, 2016 18:57
Get Local Load Balancer Prices
import SoftLayer
package = 194
from pprint import pprint as pp
client = SoftLayer.Client()
categoryObjectMask = "mask[isRequired, itemCategory[id, name]]"
configurations = client['Product_Package'].getConfiguration(
id=package, mask=categoryObjectMask)
@greyhoundforty
greyhoundforty / Order_lb.md
Created April 12, 2016 19:33
Order a Load Balancer

Get the Package ID

I am using the jt command line utility to parse the output

curl -sk "https://$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY@api.softlayer.com/rest/v3/SoftLayer_Product_Package/getAllObjects"| jt [ id % ] name %|grep Load
194	Load Balancers

Get the Price ID