Skip to content

Instantly share code, notes, and snippets.

View openfly's full-sized avatar

Matt Joyce openfly

View GitHub Profile
@openfly
openfly / openstack_foundation_affiliations.py
Created October 2, 2012 18:01 — forked from YorikSar/openstack_foundation_affiliations.py
A quick hack to tally OpenStack Member affiliations
from pprint import pprint
from urllib2 import urlopen
from bs4 import BeautifulSoup
counts = {}
for letter in [chr(a) for a in xrange(ord('A'), ord('Z') + 1)] + ['intl']:
url = "http://www.openstack.org/community/members/?letter=%s" % (letter,)
soup = BeautifulSoup(urlopen(url).read())
@openfly
openfly / PS1 Example
Created April 4, 2013 03:36
A cool bash shell prompt that displays emoticons that match up to exit status of last ran command.
#!/bin/bash
function __RETURN_CODE {
RETCODE=$?
case $RETCODE in
0) RETSTR=" 😈 " ;;
1) RETSTR=" 😭 " ;;
2) RETSTR=" 😱 " ;;
#!/usr/bin/env python
import socket
from kombu import Connection
host = "localhost"
port = 5672
user = "guest"
password = "guest"
vhost = "/"
url = 'amqp://{0}:{1}@{2}:{3}/{4}'.format(user, password, host, port, vhost)
with Connection(url) as c:
source of arduino:
/***************************************************************************
* File Name: serial_MAX31865.h
* Processor/Platform: Arduino Uno R3 (tested)
* Development Environment: Arduino 1.0.5
*
* Designed for use with with Playing With Fusion MAX31865 Resistance
* Temperature Device (RTD) breakout board: SEN-30202 (PT100 or PT1000)
* ---> http://playingwithfusion.com/productview.php?pdid=25
@openfly
openfly / lemurs.py
Created March 4, 2015 03:01
Lemur bot for slack
#!/usr/bin/env python
import flickrapi
import time
from pyslack import SlackClient
api_key = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
api_secret = u'YYYYYYYYYYYYYYYYYYY'
flickr = flickrapi.FlickrAPI(api_key, api_secret)
@openfly
openfly / bcf.py
Created April 28, 2015 18:55
BCF demo cgi script for interop
#!/usr/bin/python
# -*- coding: UTF-8 -*-# enable debugging
import cgitb
import sys
import json
import requests
import pprint
import codecs
import getpass
@openfly
openfly / set_exif.py
Created April 30, 2015 23:15
an example of how to set some exif data on an image.
#!/usr/bin/python
from gi.repository import GExiv2
import pprint
exif = GExiv2.Metadata('test.jpg')
lat = exif.get_gps_latitude()
lon = exif.get_gps_longitude()
print "Latitude: %s" % lat
print "Longitude: %s" % lon
@openfly
openfly / imgur_upvote.py
Created April 30, 2015 23:34
upvote imgur automatically
#!/usr/bin/env python
import sys
import time
import json
import requests
import pprint
import codecs
imgur_client = "6091596e15cc839"
def acquire_comments(username, imgur_client):
count = count_comments(username, imgur_client)
if ( count > 0):
print "count of commentary is %s" % count
pages = int(count / 50)
finger = 0
f = codecs.open(username + ".csv", encoding='utf-8', mode='w+')
while ( finger < pages ):
header= {"Content-Type": "text", "Authorization": "Client-ID " + imgur_client}
r = requests.get("https://api.imgur.com/3/account/" + username + "/comments/newest/" + str(finger) + ".json", headers=header)
@openfly
openfly / gist:905963795159e7f791ca
Created September 17, 2015 19:39
weird saltstack behavior....
# cat actions/restart.sls
include:
- jenkins.actions.stop
- jenkins.actions.start
# cat actions/start.sls
# Starts the tomcat service
tomcat_start:
service.running:
- name: tomcat