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
sudo yum -y install python-virtualenv
virtualenv my-venv
source my-venv/bin/activate
git clone url-for-bloom
cd bloom
python setup.py develop
./bin/bloom-generate
@ralphbean
ralphbean / julython-subscribe.py
Created July 12, 2013 19:58
Add the julython hook to all of your repos.
#!/usr/bin/env python
""" Given a username, add the julython hook to all of your repos.
Its kind of a pain... this script needs your username, your password, *and* an oauth token.
To generate an oauth token, do the following:
- Navigate to github.com.
- Click on the "account settings" icon in the top right.
- Click on the "Applications" menu on the left.
- Click on "Create new token" next to "Personal API Access Tokens"
@ralphbean
ralphbean / ansible-fedmsg-plugin.py
Created July 10, 2013 02:48
A first draft of a fedmsg module for ansible.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2013, Ralph Bean <[email protected]>
# LGPLv2+
#
# You can pass this action an arbitrary number of kw arguments which will be
# used to make up the main message body (json).
#
# Dedicated to Seth Vidal. This was his idea.
@ralphbean
ralphbean / fedmsg-cert-dump.py
Created July 2, 2013 01:31
A script that listens to the bus and tries to tell you which certs failed to validate, and which node they originally came from.
import fedmsg
import fedmsg.config
import fedmsg.crypto
import M2Crypto.X509
config = fedmsg.config.load_config()
import logging
logging.basicConfig()
@ralphbean
ralphbean / fedmsg-php-test.php
Created July 2, 2013 00:30
A test script to see if we can send a message signed consistently.
<?php
// globals
$config = 0;
$queue = 0;
// A utility function, taken from the comments at
// http://php.net/manual/en/language.types.boolean.php
function to_bool ($_val) {
$_trueValues = array('yes', 'y', 'true');
File "/usr/bin/fedmsg-hub", line 9, in <module>
load_entry_point('fedmsg==0.6.8', 'console_scripts', 'fedmsg-hub')()
File "/usr/lib/python2.6/site-packages/fedmsg/commands/hub.py", line 71, in hub
command.execute()
File "/usr/lib/python2.6/site-packages/fedmsg/commands/__init__.py", line 93, in execute
return self._daemonize()
File "/usr/lib/python2.6/site-packages/fedmsg/commands/__init__.py", line 89, in _daemonize
return self.run()
File "/usr/lib/python2.6/site-packages/fedmsg/commands/hub.py", line 66, in run
main(options=self.config)
@ralphbean
ralphbean / gist:5814056
Created June 19, 2013 12:50
example-bodhi-fedmsg-config.py
# Throw this in /etc/fedmsg.d/
config = dict(
endpoints = dict(
bodhi=[
"tcp://localhost:3000",
# Add more of these on more ports if running multiple wsgi procs
]
)
)
@ralphbean
ralphbean / list-all-repos.py
Created June 7, 2013 23:17
Script to list all repos for a github organization
#!/usr/bin/env python
""" Print all of the clone-urls for a GitHub organization.
It requires the pygithub3 module, which you can install like this::
$ sudo yum -y install python-virtualenv
$ mkdir scratch
$ cd scratch
$ virtualenv my-virtualenv
#!/usr/bin/env python
# A script to count the number of current and maximum fedmsg zeromq connections
# Author: Luke Macken <[email protected]>
# License: GPLv3
import os
import requests
from BeautifulSoup import BeautifulSoup
cur_sessions = 0
@ralphbean
ralphbean / check_datanommer_timesince.py
Created April 29, 2013 14:57
Nagios/NRPE check for Fedora Infrastructure's datanommer
#!/usr/bin/env python
""" NRPE check for datanommer/fedmsg health.
Given a category like 'bodhi', 'buildsys', or 'git', return an error if
datanommer hasn't seen a message of that type in such and such time.
Requires: python-dateutil
Usage:
$ check_datanommer_timesince CATEGORY WARNING_THRESH CRITICAL_THRESH