Skip to content

Instantly share code, notes, and snippets.

View mitgr81's full-sized avatar

Chris McGraw mitgr81

  • SONIFI Solutions
  • Sioux Falls, SD
View GitHub Profile
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/lettuce/core.py", line 117, in __call__
ret = self.function(self.step, *args, **kw)
File "/src/portal/tests/lettuce/terrain/steps.py", line 86, in horizontal_dragon_drop
test.dragon_drop(source, dest, action_chains=True)
File "/src/portal/tests/python/lnet/testing/acceptance.py", line 2534, in dragon_drop
self.__dragon_drop(source_element, dest_element, action_chains, multiplier)
File "/src/portal/tests/python/lnet/testing/acceptance.py", line 2581, in __dragon_drop
source_element._execute(Command.DRAG_ELEMENT, {'x': drag_coord['x'], 'y': drag_coord['y'] * multiplier})
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webelement.py", line 194, in _execute
@mitgr81
mitgr81 / Crash Log
Created July 20, 2012 04:46
CurseClient Logs
Process: Curse Client [30288]
Path: /Applications/Curse Client.app/Contents/MacOS/Curse Client
Identifier: com.curse.CurseClient
Version: 4.0.0.425 Beta (4.0.0.425)
Code Type: X86 (Native)
Parent Process: launchd [184]
Date/Time: 2012-07-19 23:22:27.755 -0500
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
#showtooltip Misdirection
/focus [modifier: alt]
/stopmacro [modifier: alt]
/cast [target=focus, help, exists, nodead][help][target=pet, exists,nodead] Misdirection
@mitgr81
mitgr81 / servers.py
Created February 18, 2013 04:30
Just a little scriptlet that runs a frontend (in this case, node) web server alongside a backend (in this case, python) server. This should not be used in production unless otherwise proven.
#!/usr/bin/env python
import subprocess
import socket
from multiprocessing import Process
import sys
if sys.version_info < (3,):
range = xrange
BIND_IP = '0.0.0.0'
@mitgr81
mitgr81 / Markdown Flasker
Created April 15, 2013 20:51
Simple bootstrapped markdown renderer in Flask.
#!/usr/bin/env python
from flask import Flask, render_template, Markup
from flask.ext.bootstrap import Bootstrap
import markdown2
app = Flask(__name__)
Bootstrap(app)
@app.route("/")
@mitgr81
mitgr81 / drupal_models.py
Created May 10, 2013 18:18
Drupal authorization in django-tastypie
from django.db import models
class Sessions(models.Model):
id = models.IntegerField(primary_key=True, db_column='uid')
session_id = models.CharField(max_length=64, db_column='sid')
class Meta:
db_table = u'sessions'
managed = False # Don't let Django create the tables for this model.
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
#!/usr/bin/env python
import random
import redis_wrap
print "All hashes %s " % redis_wrap.SYSTEMS['default'].keys('*')
in_progress_pushes = redis_wrap.get_hash('http://pants.com/ribble')
print "I gotz %s" % in_progress_pushes.keys()
in_progress_pushes['channel'] = random.randint(1040, 1045)
@mitgr81
mitgr81 / consumer.py
Created July 12, 2013 21:03
Just a bit of playing with Celery to see how to schedule tasks for the FUTURE!
from tasks import add
result = add.delay(425, 554)
result.ready()
# OUT: False
result.get()
# OUT: 979
result = add.apply_async((425, 554), countdown=3)
result.ready()
# OUT: False
result.ready()
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]