Skip to content

Instantly share code, notes, and snippets.

View tonybaloney's full-sized avatar

Anthony Shaw tonybaloney

View GitHub Profile
apt-get remove apache2 -y
apt-get autoremove -y
curl https://repogen.simplylinux.ch/txt/sources_c74a15400e68208192ca8980c7a90e7b678f2822.txt | sudo tee /etc/apt/sources.list
sudo apt-get update --fix-missing
sudo apt-get install git software-properties-common gcc
sudo add-apt-repository ppa:evarlast/golang1.4 -y
sudo apt-get update
sudo apt-get install golang -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list
Rule:
---
description: 'Ask the StackStorm team every week when the next version is coming out'
tags: []
type:
ref: standard
parameters:
enabled: true
name: weekly_irritation
trigger:
Today I used as the blog post as a starting point https://libcloud.apache.org/blog/2016/02/05/libcloud-containers-example.html. I came across a couple of issues with the example code that meant it didn't work. I have made some small changes to your example to get it to work. I also found that the install_image(path) method sometimes gets a JSON parsing error due to the docker API streaming multiple new line limited json messages. By adding the check if the image has been downloaded allows it to be rerun again and the deployment will work. With the docker image tomcat:8.0 you need to provide a command parameter in deploy_container call otherwise the container starts and immediately stops. Will continue to evaluate as it looks like it will be very useful.
Code for my working example below:
from libcloud.container.providers
import get_driver from libcloud.container.types
import Provider
driver = get_driver(Provider.DOCKER)
docker_driver = driver(host='https://198.61.239.128', port=4243, key_file='key.pem'
---
version: '2.0'
argo.deploy_global:
type: direct
input:
- region
- location
- name
- image
from os import listdir
from os.path import isfile, join
import re
import matplotlib.pyplot as plt
import numpy as np
path = 'transcripts'
# use libcloud 1.0.0-rc2
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.common.dimensiondata import API_ENDPOINTS
# instantiate driver connection - 1 instance per region
cls = get_driver(Provider.DIMENSIONDATA)
# list regions
for (region, value) in API_ENDPOINTS.items():
from sciencelogic.client import Client
from pprint import pprint
c = Client('jazz', 'hands!', 'https://au-monitoring.mcp-services.net/')
# API details
print(c.sysinfo)
# Get the first device
devices = c.devices(details=True)
import timeit
setup = '''
import random
random.seed('slartibartfast')
s = [random.random() for i in range(1000)]
timsort = list.sort
'''
import pandas as pd
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
import numpy
import pylab
with open('tweets.csv') as tweets:
df = pd.read_csv(tweets)
import pandas as pd
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from matplotlib import pyplot as plt
with open('tweets.csv') as tweets:
df = pd.read_csv(tweets)
data = []
sid = SentimentIntensityAnalyzer()
df['timestamp'] = pd.to_datetime(df['timestamp'])