Skip to content

Instantly share code, notes, and snippets.

@mazz
mazz / gist:6a74a085e8557f3b1c69
Created May 27, 2014 00:41
pika ampq pyramid error
#function to get data from queue
def _get_tweets(size=10):
tweets = []
# Get ten messages and break out
count = 0
message_count = _queue_message_count()
print("size: " + str(size) + " message_count: " + str(message_count))
if message_count > 0:
@mazz
mazz / gist:0737c55e877a51d0582c
Created July 16, 2014 15:18
initpyr quickstart
cd initpyr
./initpyr.py -n foo -s
cd foo_env/foo
../bin/pserve development.ini
web browser: http://0.0.0.0:6543/login
user: admin
pass: admin
@mazz
mazz / keybase.md
Created February 28, 2015 16:06
keybase.md

Keybase proof

I hereby claim:

  • I am mazz on github.
  • I am mazz (https://keybase.io/mazz) on keybase.
  • I have a public key whose fingerprint is 81DA A3FA EF1C DDF3 B15A A6B4 A953 707A A850 34D5

To claim this, I am signing this object:

# These are installation specific values created when PyQt4 was configured.
_pkg_config = {
'pyqt_bin_dir': '/System/Library/Frameworks/Python.framework/Versions/2.7/bin',
'pyqt_config_args': '',
'pyqt_mod_dir': '/Library/Python/2.7/site-packages/PyQt4',
'pyqt_modules': 'QtCore QtGui QtHelp QtMultimedia QtNetwork QtDBus QtDeclarative QtOpenGL QtScript QtScriptTools QtSql QtSvg QtTest QtWebKit QtXml QtXmlPatterns phonon QtDesigner',
'pyqt_sip_dir': '/System/Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4',
'pyqt_sip_flags': '-x VendorID -t WS_MACX -x PyQt_NoPrintRangeBug -t Qt_4_8_4 -x Py_v3 -g',
'pyqt_version': 0x040a00,
'pyqt_version_str': '4.10',
[michael@varga (Fri Mar 29 19:14:18) /Library/Python/2.7/site-packages]% cd ~/Downloads/PyQt-mac-gpl-4.10
[michael@varga (Fri Mar 29 19:14:22) ~/Downloads/PyQt-mac-gpl-4.10]% make
/Developer/Tools/Qt/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.8/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ qpytextobject.h -o moc_qpytextobject.cpp
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -fPIC -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.8/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I/System/Library/Frameworks/Pyt
@mazz
mazz / mysql2sqlite.sh
Created August 14, 2016 05:35 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@mazz
mazz / auto_dubstep.rb
Created August 22, 2016 20:58 — forked from xavriley/auto_dubstep.rb
Auto generating dubstep with Sonic Pi
# DUBSTEP
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
# WOBBLE BASS
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
~/web/meru_env/meru (harvest_photos ✘)✭ ᐅ git push origin harvest_photos
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 584 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: env: python2: No such file or directory
To maz@localhost:/Library/git/meru.git
! [remote rejected] harvest_photos -> harvest_photos (pre-receive hook declined)
error: failed to push some refs to 'maz@localhost:/Library/git/meru.git'
@mazz
mazz / controller.py
Created November 20, 2016 17:35
zeromq controller
from __future__ import print_function
import uuid
import time
import json
from six.moves import xrange
import zmq
from actors.worker import Worker
from multiprocessing import Process, Event
from pushpull.models import DBSession
@mazz
mazz / worker.py
Created November 20, 2016 17:36
zeromq worker
import uuid
import time
import random
import zmq
class Worker(object):
def __init__(self, stop_event):
self.stop_event = stop_event
self.context = zmq.Context()