Skip to content

Instantly share code, notes, and snippets.

@blink1073
blink1073 / metatlas.spec
Last active August 29, 2015 14:17
MetAtlas Spec
/*
A KBase Atlas to liquid chromatography–mass spectrometry (LCMS) data
*/
module MetaboliteAtlas2 {
/* Metabolite Compound object
*
* name - common name of the compound
@blink1073
blink1073 / xonsh_startup_errors
Created March 31, 2015 22:43
Xonsh Startup Output Errors
stevensilvester: ~
$ xonsh
/usr/local/etc/bash_completion.d/abook: line 3: have: command not found
/usr/local/etc/bash_completion.d/ant: line 45: syntax error in conditional expression: unexpected token `('
/usr/local/etc/bash_completion.d/ant: line 45: syntax error near `-@(?'
/usr/local/etc/bash_completion.d/ant: line 45: ` if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then'
/usr/local/etc/bash_completion.d/apache2ctl: line 3: have: command not found
/usr/local/etc/bash_completion.d/apt: line 12: syntax error in conditional expression: unexpected token `('
/usr/local/etc/bash_completion.d/apt: line 12: syntax error near `@(i'
/usr/local/etc/bash_completion.d/apt: line 12: ` if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then'
@blink1073
blink1073 / zmq_router_dealer.py
Created April 6, 2015 18:33
zmq router/dealer
import zmq
from multiprocessing import Process
import time
def node(router_port, dealer_port1, dealer_port2):
context = zmq.Context.instance()
router = context.socket(zmq.ROUTER)
router.bind("tcp://*:%s" % router_port)
print("Running server on port: ", router_port)
@blink1073
blink1073 / dzm_refactor.py
Created April 8, 2015 13:08
dzmq refactor
import os
import sys
import socket
import netifaces
import platform
import struct
import atexit
import logging
import base64
import time
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blink1073
blink1073 / mpld3_custom_widget.ipynb
Last active August 29, 2015 14:24
Mpld3 IPython Widget for IPython 3.2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blink1073
blink1073 / mpl_widget.ipynb
Last active August 29, 2015 14:24
Matplotlib Widget for IPython 3.2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blink1073
blink1073 / nersc_ipython.md
Last active August 29, 2015 14:25
IPython at Nersc Setup

Log in to https://ipython.nersc.gov/. Run the following in a notebook cell to get set up (note this only has to be done once for a given user):

%%file ~/.ipython/profile_default/startup/ipython_config.py
import sys
sys.path.insert(0, '/project/projectdirs/metatlas/python_pkgs/')
import os
os.environ['R_LIBS_USER'] = '/project/projectdirs/metatlas/r_pkgs/'
@blink1073
blink1073 / pygments_completion.py
Last active August 29, 2015 14:26
Token Completions Using Pygments
from pygments.lexers import get_lexer_for_filename
from pygments.token import Token
def get_matches(code, filename):
"""Get token-based matches for the current context in a file.
"""
lexer = get_lexer_for_filename(filename)
tokens = [i for i in lexer.get_tokens(code)]
@blink1073
blink1073 / metatlas_bokeh.ipynb
Created July 31, 2015 02:38
Metatlas Bokeh Test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.