Skip to content

Instantly share code, notes, and snippets.

View ralphbean's full-sized avatar

Ralph Bean ralphbean

  • Red Hat, Inc
  • Rochester, NY
View GitHub Profile
@ralphbean
ralphbean / testing-pubsubhubbub.sh
Created September 19, 2012 19:09
Try to subscribe to another github users events and fail..
#!/bin/bash
# Subscribe to my own repo's events as me
# This succeeds with a 204.
curl -u "ralphbean" -i \
https://api.github.com/hub \
-F "hub.mode=subscribe" \
-F "hub.topic=https://github.com/ralphbean/pyrasite/events/push" \
-F "hub.callback=http://requestb.in/wxgbx8wx"
@ralphbean
ralphbean / instructions.txt
Created September 22, 2012 16:35
Files needed for
mkvirtualenv my_virtualenv
git clone git://github.com/ralphbean/fedmsg.git
cd fedmsg
python setup.py develop
cd ..
mkdir my_consumer_project
cd my_consumer_project
# First copy my_consumer.py and setup.py from this gist into this directory.
# Then copy the development fedmsg config from the other git clone like this
cp -rf ../fedmsg/fedmsg.d/ .
@ralphbean
ralphbean / attribute-wat.py
Created September 24, 2012 17:47
Surprised to learn '__' has semantic meaning in python.
""" Surprised to find that the '__' in python has semantic meaning.
Tested in python-2.7 and python-3.2.
"""
class MyClass(object):
_with_single_under = False
__with_double_unders = False
@ralphbean
ralphbean / gist:3784866
Created September 25, 2012 22:31
log from fedmsg-relay during a crash and bloat
[moksha.hub] INFO 2012-08-04 19:47:57,938 Loading the Moksha Hub
[moksha.hub] INFO 2012-08-04 19:47:57,938 Loading Consumers
[moksha.hub] INFO 2012-08-04 19:47:57,938 RelayConsumer consumer is watching the 'org.fedoraproject.*' topic
[moksha.hub] INFO 2012-08-04 19:47:57,939 Binding publish socket to 'tcp://app01.phx2.fedoraproject.org:3999'
[moksha.hub] INFO 2012-08-04 19:47:58,056 Resolving app01.phx2.fedoraproject.org to ['10.5.126.31']
[moksha.hub] INFO 2012-08-04 19:47:58,134 Resolving app01.phx2.fedoraproject.org to ['10.5.126.31']
[moksha.hub] INFO 2012-08-04 19:47:59,135 Subscribing to org.fedoraproject. on 'ZmqEndpoint(type='bind', address='tcp://10.5.126.31:3998')'
[moksha.hub] INFO 2012-08-04 19:47:59,136 Loading Producers
@ralphbean
ralphbean / form_validation.py
Created October 1, 2012 14:18
Playing with tw2 form validation and the MatchValidator.
import tw2.core as twc
import tw2.forms as twf
class SettingsForm(twf.Form):
submit = twf.SubmitButton(value='Update')
action = '/update_settings'
class child(twf.TableLayout):
@ralphbean
ralphbean / message-size.py
Created October 1, 2012 16:52
Script to generate an educated guess at the bandwidth/load requirements for fedmsg.
""" Script to do some math to make an educated guess at
bandwith requirements of fedmsg for Fedora Infrastructure.
::
--- ~/scratch » python message-size.py
kbps: 6.49658203125
mbps: 0.00634431838989
"""
@ralphbean
ralphbean / patch.diff
Created October 20, 2012 11:52
Handle an already pythonified ssh key
diff --git a/fas/validators.py b/fas/validators.py
index 5a6db4f..d5391f2 100644
--- a/fas/validators.py
+++ b/fas/validators.py
@@ -181,7 +181,10 @@ class ValidSSHKey(validators.FancyValidator):
def _to_python(self, value, state):
# pylint: disable-msg=C0111,W0613
- return value.file.read().decode('utf-8')
+ if isinstance(value, unicode):
@ralphbean
ralphbean / active-contrib.py
Created November 5, 2012 18:01
Check active contributors from datanommer
#!/usr/bin/env python
""" Print a list of the contributors whose names have appeared in any event
in the last 60 days
"""
__requires__ = 'datanommer==0.1.8'
import sys
from pkg_resources import load_entry_point
import datanommer.models as m
import fedmsg.config
@ralphbean
ralphbean / gist:4021896
Created November 6, 2012 01:35
Identifying a bug in tw2.{dynforms,core} 2.1.2
# -*- coding: utf-8 -*-
'''
Created on 13.04.2012
Ported to tw2 on 25.05.2012
@author: moschlar
'''
import tw2.core as twc
import tw2.forms as twf
@ralphbean
ralphbean / judgement.py
Created November 6, 2012 01:35
Identifying a bug in tw2.{dynforms,core} 2.1.2
# -*- coding: utf-8 -*-
'''
Created on 13.04.2012
Ported to tw2 on 25.05.2012
@author: moschlar
'''
import tw2.core as twc
import tw2.forms as twf