Skip to content

Instantly share code, notes, and snippets.

🐍
Snek

Greg Taylor gtaylor

🐍
Snek
Block or report user

Report or block gtaylor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gtaylor
gtaylor / wordpress_api.py
Created Oct 11, 2015
Wordpress.com API Access token
View wordpress_api.py
import requests
data = {
'client_id': 1234,
'redirect_uri': 'http://gc-taylor.com',
'client_secret': 'yoursecrethere',
'code': 'yourcode',
'grant_type': 'authorization_code',
}
@gtaylor
gtaylor / gist:1901752
Created Feb 24, 2012
Dynamic Fabric deployment with boto
View gist:1901752
def ec2():
"""
Set env.roledefs according to our deployment setup. From this, an
env.hosts list is generated, which determines which hosts can be
messed with. The roledefs are only used to determine what each server is.
Since we are running on EC2, these instances are completely variable.
We need to hit their API to determine which instances are currently in
service.
"""
@gtaylor
gtaylor / gist:1764759
Created Feb 8, 2012
Starting an instance with boto
View gist:1764759
import boto
# This is used to create an EC2Connection object, which provides an API to
# work with the EC2 service.
conn = boto.connect_ec2('your-aws-key-here', 'your-secret-here')
# Launch an instance with the specified AMI (Amazon Machine Instance)
# in a small VM. In this case, the AMI is Ubuntu 11.10.
reservation = conn.run_instances('ami-0fe3dc7b', instance_type='t1.micro')
@gtaylor
gtaylor / gist:1635814
Created Jan 18, 2012
jQuery form validation mixin
View gist:1635814
class FrontendFormErrorHandlingMixin(object):
"""
Provides some convenience methods for handling errors on the front end.
See :meth:`get_errors`.
"""
def get_errors(self):
"""
Returns a list of form validation erros
in a dictionary format. More JSON friendly. Less stupid.
"""
View gist:f232db1e3302272552d0
<match graylog2.**>
type copy
<store>
type gelf
host {{ graylog2_server_host }}
port {{ graylog2_server_port }}
heartbeat_type tcp
flush_interval 5s
</store>
#<store>
View gist:912caae15e70cdcf4d4e
[2014-10-14 01:30:13,857: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
File "/home/cbweb/.virtualenvs/coursebook/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 278, in start
blueprint.start(self)
File "/home/cbweb/.virtualenvs/coursebook/local/lib/python2.7/site-packages/celery/bootsteps.py", line 123, in start
step.start(parent)
File "/home/cbweb/.virtualenvs/coursebook/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 821, in start
c.loop(*c.loop_args())
File "/home/cbweb/.virtualenvs/coursebook/local/lib/python2.7/site-packages/celery/worker/loops.py", line 70, in asynloop
next(loop)
View gist:25c635badd05ae3527a4
[2014-10-14 11:47:28,336: INFO/MainProcess] Connected to redis://:**@pub-redis-15274.us-east-mz.2.ec2.garantiadata.com:15274/0
[2014-10-14 11:47:28,372: INFO/MainProcess] mingle: searching for neighbors
[2014-10-14 11:47:29,430: INFO/MainProcess] mingle: sync with 2 nodes
[2014-10-14 11:47:29,431: INFO/MainProcess] mingle: sync complete
[2014-10-14 11:47:29,493: WARNING/MainProcess] celery@syncing.celery-i-4c2bb361 ready.
[2014-10-14 11:47:29,980: INFO/MainProcess] Events of group {task} enabled by remote.
View gist:9064a5f325b9fc7b4ba2
{
"school": {
"url": "https://get.pathwright.local/",
"image": "https://d3s4ni8cjo6ws9.cloudfront.net/api/file/DpJ9HPskQV2Q3k1oxNRf?policy=eyJleHBpcnkiOiAiMTQxMzQwMjkyMCJ9&signature=84cbdf3ed6b3abb22380e8218f0e1a25ac5a83d17c953fd78117ee180bbceaf6",
"id": 17,
"name": "PathwrightU"
},
"class_section": {
"url": "https://get.pathwright.local/course/pw101/571/",
"id": 571,
View gist:c9fdf67aa83cd58f74af
{
"school": {
"url": "https://get.pathwright.local/",
"image": "https://d3s4ni8cjo6ws9.cloudfront.net/api/file/DpJ9HPskQV2Q3k1oxNRf?policy=eyJleHBpcnkiOiAiMTQxMzQwMjkyMCJ9&signature=84cbdf3ed6b3abb22380e8218f0e1a25ac5a83d17c953fd78117ee180bbceaf6",
"id": 17,
"name": "PathwrightU"
},
"class_section": {
"url": "https://get.pathwright.local/course/pw101/571/",
"id": 571,
View gist:e3926a90fe108d52a4c8
WITH RECURSIVE cte (
id, discussion_id, body, num_votes, last_edited_time,
class_section_id, created_time, modified_time,
author_id, reply_parent_id, num_inappropriate_flags,
path, depth
) AS (
SELECT discussion_response.id, discussion_response.discussion_id,
discussion_response.body, discussion_response.num_votes,
discussion_response.last_edited_time,
discussion_response.class_section_id,
You can’t perform that action at this time.