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
import time
import datetime
some_datetime = datetime.datetime.now()
print time.mktime(some_datetime.timetuple())
@ralphbean
ralphbean / tw2_tweenery.py
Created March 30, 2012 12:20
Injecting tw2 jquery_ui and jquery.js on every page of a pyramid app
import tw2.jqplugins.ui
def remove_jq_factory(handler, registry):
""" Insert tw2 jquery and jquery_ui on every page.
In order to use this, you need to add the following to your
myapp/__init__.py file:
config.add_tween('myapp.tween.remove_jq_factory')
#!/usr/bin/env python
# Copyright (C) 2006, Red Hat, Inc.
# Copyright (C) 2009, One Laptop Per Child Association Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@ralphbean
ralphbean / gist:2359197
Created April 11, 2012 13:07
tox output from my attempted run of virtualenvwrapper tests
_________________________________ [tox sdist] __________________________________
[TOX] ***creating sdist package
[TOX] /home/threebean/devel/virtualenvwrapper$ /home/threebean/foo-env/bin/python setup.py sdist --formats=zip --dist-dir .tox/dist >.tox/log/0.log
[TOX] ***copying new sdistfile to '/home/threebean/.tox/distshare/virtualenvwrapper-3.2.zip'
______________________________ [tox testenv:py27] ______________________________
[TOX] ***reusing existing matching virtualenv py27
[TOX] ***upgrade-installing sdist
[TOX] /home/threebean/devel/virtualenvwrapper/.tox/py27/log$ ../bin/pip install --download-cache=/home/threebean/devel/virtualenvwrapper/.tox/_download /home/threebean/devel/virtualenvwrapper/.tox/dist/virtualenvwrapper-3.2.zip -U --no-deps >4.log
[TOX] WARNING:test command found but not installed in testenv
cmd: /usr/bin/bash
@ralphbean
ralphbean / app.js
Created April 12, 2012 17:41
plm's javascript stuff.
function init_app(name, thumb_url, shortName) {
Ext.onReady(function(){
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'get-images.php', method: 'POST'
}),
root: 'images',
fields: [
'name', 'url',
diff --git a/python-tw2-jqplugins-ui.spec b/python-tw2-jqplugins-ui.spec
index bceebee..b39915e 100644
--- a/python-tw2-jqplugins-ui.spec
+++ b/python-tw2-jqplugins-ui.spec
@@ -76,6 +76,10 @@ rm -rf %{buildroot}
%{__python} setup.py install -O1 --skip-build \
--install-data=%{_datadir} --root %{buildroot}
+# This is a hack to get the jqplugins to not stomp all over each others
+# namespace declarations.
@ralphbean
ralphbean / build-em-all.sh
Created April 18, 2012 01:20
Run with "$ cat ~/srpms.txt | xargs ~/build-em-all.sh"
#!/bin/bash -e
while read pkgname
do
echo
echo "----------------------"
echo "Processing $pkgname"
echo "----------------------"
mock --rebuild $pkgname
#mock --rebuild ~/rpmbuild/SRPMS/$pkgname.fc17.src.rpm
From 22c79c413f40bbe63ef4eab9a458c4a4a17e525e Mon Sep 17 00:00:00 2001
From: Ralph Bean <[email protected]>
Date: Tue, 24 Apr 2012 20:11:35 -0400
Subject: [PATCH] NOBUILD
---
src/gnuwrapper.cpp | 2 +-
src/heaplayers/spinlock.h | 4 ++--
src/heaplayers/threadheap.h | 4 ++--
src/heaplayers/zoneheap.h | 2 +-
def randint(min=0, max=10):
"""Return an int between min and max"""
range = max - min
if range == 0:
#raise ValueError("range cannot be zero")
return min
modulos = int(float(MAX_INT) / range)
too_big = modulos * range
while True:
num = get_data()[0]
#!/usr/bin/env python
""" What's the fastest way to initialize a 2-D array? """
import time
N = 1000
WIDTH, HEIGHT = N, N