Skip to content

Instantly share code, notes, and snippets.

View tonybaloney's full-sized avatar

Anthony Shaw tonybaloney

View GitHub Profile
@tonybaloney
tonybaloney / upgrade_st2.sh
Created September 1, 2016 00:17
Upgrading StackStorm on Ubuntu 14
st2ctl stop
apt-get install --only-upgrade st2 st2chatops st2mistral st2web
/etc/init.d/mistral stop
/etc/init.d/mistral-api stop
/opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head
/etc/init.d/mistral start
/etc/init.d/mistral-api start
st2ctl start
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
#define _GNU_SOURCE
#include <sys/wait.h>
#include <sys/utsname.h>
#include <sched.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define STACK_SIZE (1024 * 1024) /* Stack size for cloned child */
"""
1. Make sure you install Pillow using `pip install Pillow` at the command line
2. Call this script with the path to the picture as the parameter, e.g.
> python pillow.py my_face.jpg
3. This will support PNG, JPEG, TIFF and BMP images
4. Upload the my_image.jpg file to complete
"""
# Import Pillow features.
from PIL import Image, ImageFilter, ImageEnhance
import pandas
import sys
import six
from pluralsight.licensing import LicensingAPIClient
import pluralsight.exceptions
import colorlog
import logging
handler = colorlog.StreamHandler()
import libcloud
cls = libcloud.get_driver(libcloud.DriverType.DNS, libcloud.DriverType.DNS.DNSIMPLE)
import requests
response = requests.get('https://my-cloud.com/api/v1/servers/')
response.json()
import requests
response = requests.request('get', 'https://my-cloud.com/api/v1/servers/')
response.json()
@tonybaloney
tonybaloney / requests_example_3.py
Last active January 15, 2017 23:04
Making a request using a session
import requests
import json
my_data = {
'server': '1234'
}
my_auth = {
'Authorization': 'Bearer dfg90823jrofiowfi4-0r'
}
response = requests.post('https://my-api.service.com/v1/servers', data=json.dumps(my_data),
import requests
import json
with requests.Session() as sess:
my_data = {
'server': '1234'
}
sess.headers['Authorization'] = 'Bearer dfg90823jrofiowfi4-0r'
response = sess.post('https://my-api.service.com/v1/servers', json=my_data)
data = sess.get('https://my-api.service.com/v1/servers/1234').json()