Skip to content

Instantly share code, notes, and snippets.

@maurodoglio
maurodoglio / ipynb_to_slides.sh
Created June 8, 2016 15:50
Convert a jupyter notebook into a slideshow and serve it
jupyter nbconvert notebook_name.ipynb --to slides --reveal-prefix https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0
# Using the built in nbconvert server won't work behind a proxy.
# Let's use a simple python server to do that.
python -m SimpleHTTPServer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maurodoglio
maurodoglio / export_regression_bugs.ipynb
Created May 23, 2016 14:33
Regression bugs export notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
req = Request(method, uri, json=data, auth=auth)
prepped_request = req.prepare()
print prepped_request.url
print prepped_request.headers
print prepped_request.text
from celery.task.control import inspect
i = inspect()
registered = i.registered()
active_workers = registered.keys()
@maurodoglio
maurodoglio / send_event.py
Created June 17, 2014 18:04
Job completed event
from django.conf import settings
from treeherder.events.publisher import JobStatusPublisher
p = JobStatusPublisher(settings.BROKER_URL)
p.publish(
1,# job_id
1,# resultset_id
'mozilla-inbound', # repo
'completed' # status
)
@maurodoglio
maurodoglio / treeherder_socketio_client.html
Created December 20, 2013 17:11
treeherder socketio client example
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script>
// Create SocketIO instance, connect
var socket = io.connect('http://local.treeherder.mozilla.org:8005/events');
// Add a connect listener
socket.on('connect',function() {
@maurodoglio
maurodoglio / gist:6548889
Created September 13, 2013 10:14
This is a modified version of treeherder/log_parser/tasks.py that profiles the execution of a parse_log run. It generates one profile file per task run. You can directly use it in your development environment with the process_objects periodic task running
import simplejson as json
from celery import task
import time
from treeherder.model.derived import JobsModel
from treeherder.log_parser.artifactbuildercollection import ArtifactBuilderCollection
import profile
@maurodoglio
maurodoglio / gist:6548820
Created September 13, 2013 10:07
This is the list of commands I used to read a list of files containing profiling data. It was run inside a ipython shell
import pstats
# in the ipython shell this returns a list
# containing the output of the shell command ls
# I generated many profile files, one per log parsed.
# all the file names were prefixed with parse_log
profiles = !ls parse_log*
# read the first file in the list
stats = pstats.Stats(profiles.pop())