This script works as a wrapper for sbatch command.
Usage:
sherlock-one-liner python --version
#!/bin/bash | |
# parse args | |
if [ $# -lt 2 ] ; then | |
echo "usage: $0 <target-server> <login-server> [local port (default: 18888)] [target port (default: 8888)] [login port (default: rand)]" >&2 | |
exit 1 | |
fi | |
target=$1 |
This script works as a wrapper for sbatch command.
Usage:
sherlock-one-liner python --version
Host github.com | |
User somebody@somewhere.com | |
Port 22 | |
Hostname github.com | |
IdentityFile ~/.ssh/github | |
IdentitiesOnly yes | |
Host * | |
ControlMaster auto | |
ControlPath ~/.ssh/mux-%r@%h:%p |
CC = gcc | |
LD = gcc | |
CFLAGS = -Wall -Wextra -O2 | |
LDFLAGS = #-lpthread -lm | |
SRCS := $(wildcard *.c) | |
OBJS = $(SRCS:.c=.o) | |
DEPS = $(SRCS:.c=.dep) | |
EXEC = $(SRCS:.c=) | |
RM = rm -f |
=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",100)),99)) |
これは stfuawsc_itg Advent Calendar 2014 4日目の記事です。
プログラミングをしていると、いろいろなバージョンの環境を行ったり来たりしたくなることがあります。たとえば言語処理は python 2 へ nltk を入れてやりたい。シミュレーションは python 3 へ numpy 入れてやりたいとか。
そういうふうに言語やモジュールのバージョンをいろいろ組合せた環境を気軽に切り替えられると便利です。
実際そういうことを可能にするツールはたくさんあります。virtualenv, pyenv など。
ここで紹介する conda というツールもその1つです。
virtualenv などでは、モジュールを入れるときは通常の python の流儀でインストールするのですが、インストールがうまくいかないというのはよくあることです。conda ではあらかじめビルドされたものを入れるので、楽です。もちろん conda に用意されていないモジュールもありますが、そういうのは pip 等通常の方法で入れて共存できます。
ではさっそく conda で python の環境を作る方法です。
<?xml version="1.0"?> | |
<Module> | |
<ModulePrefs title="Gist"> | |
<Require feature="dynamic-height"/> | |
</ModulePrefs> | |
<UserPref name="id" display_name="Gist ID" required="true" default_value="10683373"/> | |
<UserPref name="font_size" display_name="Font size (px)" required="true" default_value="12"/> | |
<UserPref name="line_height" display_name="Line height (px)" required="true" default_value="16"/> | |
<Content type="html"> | |
<![CDATA[ |
# DESCRIPTION OF PROBLEM: Implementations of sed, readlink, zcat, etc. are different on OS X and Linux. | |
# NOTE: Put this on top of your script using sed, readlink, zcat, etc. that should work alike on Mac OS X. | |
# cross-OS compatibility (greadlink, gsed, zcat are GNU implementations for OS X) | |
[[ `uname` == 'Darwin' ]] && { | |
which greadlink gsed gzcat > /dev/null && { | |
unalias readlink sed zcat | |
alias readlink=greadlink sed=gsed zcat=gzcat | |
} || { | |
echo 'ERROR: GNU utils required for Mac. You may use homebrew to install them: brew install coreutils gnu-sed' |
function copyFbRecord(oldRef, newRef) { | |
oldRef.once('value', function(snap) { | |
newRef.set( snap.value(), function(error) { | |
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); } | |
}); | |
}); | |
} |