Skip to content

Instantly share code, notes, and snippets.

View openfly's full-sized avatar

Matt Joyce openfly

View GitHub Profile
#!/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
@openfly
openfly / waht.sls
Created September 17, 2015 20:17
no op in salt.
include:
- some.awesome.state
{% some for shit here -%}
state:
cmd.run:
- name: doing some awesome shit iteratively
{% end loopy doop -%}
@openfly
openfly / gist:a83486cd56acc45b6dbc
Created September 18, 2015 16:10
example of dict iteration in salt
dict.sls
{
plugin: "http://url/path/plugin.jpi"
}
state.sls
{%- import_yaml "dict.sls" as custom_plugins %}