Skip to content

Instantly share code, notes, and snippets.

Michael mazz

Block or report user

Report or block mazz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mazz
mazz / worker.py
Created Nov 20, 2016
zeromq worker
View worker.py
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()
View ipython_server_log.txt
(sauna1_env)➜ pic2pic ipython --version
3.2.3
(sauna1_env)➜ michaelkhanna@gmail.com cat notebook.stderr.log
Starting notebook, daemon True
Starting with context {'websocket_url': 'ws://localhost:40000', 'greeting': '\n\nAvailable variables and functions:\n\n* **app** - The [WSGI application](http://docs.pylonsproject.org/docs/pyramid/en/latest/api/paster.html?highlight=wsgi%20application#pyramid.paster.get_app) object generated by bootstrapping.\n* **request** - A [pyramid.request.Request](http://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request) object implying the current request state for your script.\n* **root** - The resource [root](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-root) of your Pyramid application. This is an object generated by the [root factory](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-root-factory) configured in your application.\n* **registry** - The application [registry](http://docs.py
View gist:ba897d5adcb93aaa8090a83cd6132caf
(sauna1_env)➜ pic2pic cat /tmp/pyramid_notebook/michaelkhanna@gmail.com/notebook.stderr.log
Starting notebook, daemon True
Starting with context {'greeting': '\n\nAvailable variables and functions:\n\n* **app** - The [WSGI application](http://docs.pylonsproject.org/docs/pyramid/en/latest/api/paster.html?highlight=wsgi%20application#pyramid.paster.get_app) object generated by bootstrapping.\n* **request** - A [pyramid.request.Request](http://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request) object implying the current request state for your script.\n* **root** - The resource [root](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-root) of your Pyramid application. This is an object generated by the [root factory](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-root-factory) configured in your application.\n* **registry** - The application [registry](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-a
@mazz
mazz / gist:4259594
Created Dec 11, 2012
uses CGImageCreateWithImageInRect to perform a crop
View gist:4259594
// this chunk of code loads a jpeg image into a cgimage
// creates a second crop of the original image with CGImageCreateWithImageInRect
// writes the new cropped image to the desktop
// ensure that the xy origin of the CGRectMake call is smaller than the width or height of the original image
NSURL *originalImage = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"lockwood" ofType:@"jpg"]];
CGImageRef imageRef = NULL;
CGImageSourceRef loadRef = CGImageSourceCreateWithURL((CFURLRef)originalImage, NULL);
if (loadRef != NULL)
View gist:b31fb5a89605548868a91abb91f8faf8
(saunaenv)➜ xact ws-alembic -c conf/development.ini -x packages=all revision --auto -m "Initial migration"
Traceback (most recent call last):
File "/Users/maz/tmp/.sidha/files.noindex/websaunaproj/saunaenv/bin/ws-alembic", line 9, in <module>
load_entry_point('websauna==1.0a3', 'console_scripts', 'ws-alembic')()
File "/Users/maz/tmp/.sidha/files.noindex/websaunaproj/saunaenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/maz/tmp/.sidha/files.noindex/websaunaproj/saunaenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/Users/maz/tmp/.sidha/files.noindex/websaunaproj/saunaenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
@mazz
mazz / gist:7271625e3d312bc93e80e0f29fabfa71
Created Dec 14, 2016
websauna: KeyError: 'full_name'
View gist:7271625e3d312bc93e80e0f29fabfa71
[22:57:07] [pyramid_debugtoolbar toolbar_tween] Exception at http://localhost:6543/admin/models/user/listing
traceback url: http://localhost:6543/_debug_toolbar/exception?tb=4433257752&token=6227245c7864365c7863355c7865365c7839355c7839345c786362634e5c78313427
Traceback (most recent call last):
File "/Users/maz/webapp/websauna_env/lib/python3.5/site-packages/sqlalchemy/ext/indexable.py", line 313, in fget
value = column_value[self.index]
KeyError: 'full_name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
View gist:cff857a8ad3cba902e3f6c9c4b43530d
maz@maz-alpha:/tmp/pyramid_notebook/foo@bar.com$ cat notebook.stderr.log
Starting notebook, daemon True
Starting with context {'extra_template_paths': ['/home/maz/webapp/websauna/lib/python3.5/site-packages/pyramid_notebook/server/templates'], 'jinja_environment_options': {}, 'allow_origin': 'http://localhost:6543', 'context_hash': 1484605921, 'http_port': 40008, 'websocket_url': 'ws://localhost:40008', 'greeting': '\n\nAvailable variables and functions:\n\n* **app** - The [WSGI application](http://docs.pylonsproject.org/docs/pyramid/en/latest/api/paster.html?highlight=wsgi%20application#pyramid.paster.get_app) object generated by bootstrapping.\n* **request** - A [pyramid.request.Request](http://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request) object implying the current request state for your script.\n* **root** - The resource [root](http://docs.pylonsproject.org/docs/pyramid/en/latest/glossary.html#term-root) of your Pyramid application. This is an object generat
@mazz
mazz / gist:62db05300db5e5e6da0e0e5382e2484b
Created Dec 16, 2016
notebook has password by default
View gist:62db05300db5e5e6da0e0e5382e2484b
http://localhost:6543/notebook/login?next=%2Fnotebook%2Fnotebooks%2Fdefault-1589979049.ipynb
@mazz
mazz / gist:22f92bd25c1f6f0314eca85d72e0ef7e
Created Dec 18, 2016
A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.
View gist:22f92bd25c1f6f0314eca85d72e0ef7e
A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.
You can’t perform that action at this time.