Skip to content

Instantly share code, notes, and snippets.

@jbarratt
jbarratt / example_session
Created June 29, 2016 20:36
Remote Jupyter Notebook Helper
josh@jump:~$ ./bin/notebook.sh
Container not running, starting up
55d2f299de8e7d6683b81817556cf7bd4f627740fefe30457019a8f88c1631b7
In another terminal (or exit this and reconnect) then run:
ssh -L 8080:localhost:32771 [email protected]
Then open your browser to http://localhost:8080
When you're done, save system resources by running
./bin/notebook.sh clean
josh@jump:~$ ./bin/notebook.sh
@jbarratt
jbarratt / softnas_stats.py
Created May 27, 2016 20:39
Gather stats from the softnas API
#!/usr/bin/env python
import requests
s = requests.Session()
def url_for(path):
return "https://localhost/softnas/" + path
@jbarratt
jbarratt / datadog_nginx.py
Created March 20, 2015 19:25
Custom DataDog statsd feeder
#!/usr/bin/env python
from pygtail import Pygtail
from datadog import statsd
import re
# nginx.net.response_time
# statsd.histogram('', duration)
# nginx.net.response_codes.<x>
@jbarratt
jbarratt / sqlite_to_excel.ipynb
Created January 23, 2015 03:27
IPython Notebook Demonstrating SQLite to Excel via Pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbarratt
jbarratt / scrap.py
Created January 2, 2015 14:28 — forked from anonymous/scrap.py
#!/usr/bin/env python
import requests
import sys
import lxml.html
import urlparse
import posixpath
import os
@jbarratt
jbarratt / Testing
Last active August 29, 2015 14:07
Trivial CORS example
$ http get http://127.0.0.1:5000/ Origin:http://example.com Access-Control-Request-Method:POST Access-Control-Request-Headers:X-Requested-With
HTTP/1.0 200 OK
Access-Control-Allow-Headers: ACCEPT, CONTENT-TYPE
Access-Control-Allow-Methods: DELETE, GET, HEAD, OPTIONS, POST, PUT
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 21600
Content-Length: 25
Content-Type: application/json
Date: Wed, 08 Oct 2014 21:55:34 GMT
@jbarratt
jbarratt / fabfile.py
Last active August 29, 2015 14:06
Automated Python Package Releasing
#!/usr/bin/env python
from __future__ import print_function
from fabric.api import task, local, env, put
import re
import fileinput
import os
import datetime
import subprocess
import requests
@jbarratt
jbarratt / nblist
Last active August 29, 2015 14:04
nblist
#!/usr/bin/env python
""" A cross-platform (POSIX, at least) tool to list running IPython Notebooks
and their working directories.
This code will be incredibly simpler to write as of IPython 3.0, so
contains numerous workarounds to make it work on 2.x.
Thanks to @takluyver for the suggestions for improvement.
@jbarratt
jbarratt / nbgrep
Last active April 27, 2023 15:00
'nbgrep', search the code of all your ipython notebooks
#!/bin/bash
# usage: nbgrep 'pattern'
SEARCHPATH=~/work/
# 'jq' technique lifted with gratitude
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf
# Break on newlines instead of any whitespace
@jbarratt
jbarratt / SimpleSinisterStats.py
Created June 3, 2014 17:08
SimpleSinisterStats
from scene import *
import time
import clipboard
import sys
import speech
class SimpleSinister(object):
def __init__(self):