Skip to content

Instantly share code, notes, and snippets.

@jtriley
jtriley / LSF ipengine job script
Created Jul 22, 2010
LSF ipengine job script
View LSF ipengine job script
#!/bin/sh
#BSUB -J ipengine[1-4]
eid=$(($LSB_JOBINDEX - 1))
ipengine --logfile=ipengine${eid}.log
View example.cu
/*
Example CUDA code for Problem Set 0, CS 264, Harvard, Fall 2009.
Takes an input string and mangles it using the current date and
time on the CPU and on the GPU. Demonstrates device initialization
and error checking with libcutil, host<=>device memory transfers,
and CUDA kernel invocation.
To compile:
@jtriley
jtriley / terminalsize.py
Created Jul 26, 2011
Get current terminal size on Linux, Mac, and Windows
View terminalsize.py
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
@jtriley
jtriley / gist:1988754
Created Mar 6, 2012
change TERM=rxvt-unicode in Gentoo to use 256 colors instead of 88
View gist:1988754
It comes up as only supporting 88 colors as rxvt-unicode's terminfo database entry has it at 88 colors. If you work on external machines a lot via ssh then what you are already doing is about the best way. If you work primarily on one or a few machines then a custom/local .terminfo database can be simpler.
$ infocmp -L rxvt-unicode > rxvt-unicode.terminfo
$ [editor] rxvt-unicode.terminfo
Find max_colors and max_pairs and change them from...
max_colors#88, max_pairs#256,
to...
max_colors#256, max_pairs#32767,
Those are the values from xterm-256color. Those fields should be near
@jtriley
jtriley / example_config
Last active Oct 7, 2015
Example sshfs plugin and config for StarCluster
View example_config
# This is an example config that assumes sshfs.py is either in
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH
[vol myvol]
volume_id = vol-99999
mount_path = /results
[plugin sshfs]
setup_class = sshfs.SSHFSPlugin
local_mount_path = ~/ec2-results
@jtriley
jtriley / config
Created Aug 9, 2012
Example StarCluster plugin that tags all instances based on tags specified in the config
View config
# This is an example config that assumes tagger.py is either in
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH
[plugin tagger]
setup_class = tagger.TaggerPlugin
# add as many key=value pairs as you like separated by ','
tags = 'mykey=myvalue, mykey2=myvalue2'
[cluster default]
...
@jtriley
jtriley / config
Created Aug 9, 2012
Example StarCluster plugin that configures environment variables on all nodes
View config
# This is an example config that assumes scenv.py is either in
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH
[plugin env]
setup_class = scenv.EnvPlugin
# add as many key=value pairs as you like separated by ','
env_vars_list = 'PYTHONPATH=/path/to/python/mods, MYENV=some_value'
[cluster default]
...
@jtriley
jtriley / combinexml.py
Created Sep 5, 2012
Combine similar XML files into one document
View combinexml.py
# From: http://tentacles.posterous.com/43038706
# Take a bunch of XML files on the command line and merge them into
# one big XML document.
#
# The root element will come from the first document; the root elements of
# subsequent documents will be lost, as will anything outside the root
# (comments and whatnot).
import sys
import libxml2
@jtriley
jtriley / ssh_config_ec2
Created Oct 5, 2012
$HOME/.ssh/config for EC2
View ssh_config_ec2
Host ec2*
IdentityFile /path/to/your/ssh/key
@jtriley
jtriley / ipy_parallel_push_exec_pull.ipynb
Last active Oct 11, 2015
IPython Parallel Push/Execute/Pull Demo
View ipy_parallel_push_exec_pull.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.