Skip to content

Instantly share code, notes, and snippets.

View mivade's full-sized avatar
👋

Mike DePalatis mivade

👋
View GitHub Profile
@mivade
mivade / .gitignore
Last active February 5, 2022 15:11
Distributed Monte Carlo calculation of pi using Celery
__pycache__
*.pyc
*.ipynb
.ipynb_checkpoints
*.json
*~
@mivade
mivade / coroutinify.py
Created August 3, 2015 17:53
Adapting blocking calls to Tornado coroutines with run_on_executor decorators
import random
import time
from tornado import gen
from tornado.concurrent import run_on_executor, futures
from tornado.ioloop import IOLoop
class TaskRunner(object):
def __init__(self, loop=None):
self.executor = futures.ThreadPoolExecutor(4)
self.loop = loop or IOLoop.instance()
@mivade
mivade / hg_importing.md
Last active March 6, 2019 20:00
How to import history from one Mercurial repository into another

Importing a Mercurial repository's full history into another repository

Convert the soon-to-be child repository

With the Mercurial convert extention, you can rename branches, move, and filter files. As an example, say we have a repo with only the default branch which is to be imported into a super-repository.

For starters, we will want all our files in the child repo to be in a subdirectory of the parent repo and not include the child's

@mivade
mivade / #tornado-websocket-pubsub.rst
Last active July 5, 2019 05:48
Using Tornado websockets for the publish/subscribe pattern
@mivade
mivade / tmux.md
Created October 16, 2015 11:43
tmux notes

tmux notes

Reattaching when verisons don't match

$ tmux attach
protocol version mismatch (client 7, server 6)

#$^#^# what now?? Aha...
@mivade
mivade / bokehnado.py
Created October 25, 2015 12:34
Update Bokeh plots without using the bokeh-server
"""Demonstration of using Tornado to send updates to a Bokeh plot
without using the bokeh-server.
"""
import json
import numpy.random as npr
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.web import Application, RequestHandler
@mivade
mivade / #react-chartjs-README.md
Last active January 3, 2016 14:27
react-chartjs

react-chartjs tests

Nothing special, just playing around with react-chartjs and jspm.

Testing using Pygal to render plots server-side and embed them in a web page via a <canvas>.

@mivade
mivade / app.py
Last active May 4, 2023 16:51
Websockets with Flask via aiohttp
"""Simple demo of using Flask with aiohttp via aiohttp-wsgi's
WSGIHandler.
"""
import asyncio
from aiohttp import web
from aiohttp_wsgi import WSGIHandler
from flask import Flask, render_template
@mivade
mivade / slides.md
Created September 14, 2016 12:49 — forked from aaronwolen/slides.md
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List