This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add these functions to your ~/.bashrc file. | |
function mktunnel { | |
if [[ $* == '' ]] || [[ $1 == '-h' ]]; then | |
echo 'Usage: mktunnel LOCALPORT REMOTEPORT REMOTEHOST' | |
else | |
ssh -fCNL $1:localhost:$2 $3; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
""" | |
torque submit filter that automatically sets CUDA_VISIBLE_DEVICES | |
based upon the number of GPUs requested in a job. | |
Notes | |
----- | |
Assumes that /var/spool/torque/filters/trqgpu.py is available. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Automatically create and submit Torque job script with specified commands to qsub. | |
""" | |
import argparse | |
import os | |
import pwd | |
import tempfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
How to synchronize ZeroMQ routers and dealers. | |
""" | |
import multiprocessing as mp | |
import zmq | |
IPC_PATH = 'ipc://zmq_router_dealer_sync' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import functools | |
def do_cprofile(*dec_args): | |
""" | |
Decorator for profiling functions. | |
If a file name is passed to the decorator as an argument, profiling data | |
will be written to that file; otherwise, it will be displayed on the screen. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demo of how to use function pointers with fused types in Cython: | |
cimport cython | |
ctypedef fused fused_type: | |
cython.double | |
cython.longlong | |
cdef double func0(double x, double y): | |
return x+y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Demo of how to write a decorator with optional arguments. | |
""" | |
import functools | |
import inspect | |
def mydec(*dec_args, **dec_kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Demo of how to write a property decorator with optional arguments. | |
""" | |
import functools | |
import inspect | |
def myprop(*dec_args): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Nonblocking file logging handler using ZeroMQ. | |
""" | |
import atexit | |
import collections | |
import logging | |
import multiprocessing as mp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Exception handler that outputs exception data to twiggy logger. | |
""" | |
import re | |
import sys | |
import traceback | |
import twiggy |
OlderNewer