Skip to content

Instantly share code, notes, and snippets.

View yk-tanigawa's full-sized avatar

Yosuke Tanigawa yk-tanigawa

View GitHub Profile
@yk-tanigawa
yk-tanigawa / jupyter-remote-login.sh
Created February 2, 2018 09:46
ssh port forwarding scripts
#!/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

install necessary software to cluster machine

pyenv

  • download and install pyenv via github
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
  • add the following to ~/.bash_profile
@yk-tanigawa
yk-tanigawa / .ssh_config
Last active June 21, 2017 18:39
Templates
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
@dznz
dznz / gist:64a34466f44d1a335e75
Created October 29, 2015 22:40
Extract the filename from a path in Excel or Google spreadsheet
=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",100)),99))
@aphlysia
aphlysia / stfuawsc_itg_advent2014_4_conda.md
Last active June 16, 2023 01:05
conda で python の環境つくり

これは stfuawsc_itg Advent Calendar 2014 4日目の記事です。

プログラミングをしていると、いろいろなバージョンの環境を行ったり来たりしたくなることがあります。たとえば言語処理は python 2 へ nltk を入れてやりたい。シミュレーションは python 3 へ numpy 入れてやりたいとか。
そういうふうに言語やモジュールのバージョンをいろいろ組合せた環境を気軽に切り替えられると便利です。
実際そういうことを可能にするツールはたくさんあります。virtualenv, pyenv など。
ここで紹介する conda というツールもその1つです。
virtualenv などでは、モジュールを入れるときは通常の python の流儀でインストールするのですが、インストールがうまくいかないというのはよくあることです。conda ではあらかじめビルドされたものを入れるので、楽です。もちろん conda に用意されていないモジュールもありますが、そういうのは pip 等通常の方法で入れて共存できます。

ではさっそく conda で python の環境を作る方法です。

@ochilab
ochilab / gist-gadget.xml
Last active October 27, 2015 16:08 — forked from omoshetech-t/gist-gadget.xml
Google siteにてGistのコード埋め込みスクリプトを表示するためのGoogle Gadgetスクリプト。
<?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[
@bittner
bittner / gnu-tools-for-mac.sh
Last active December 11, 2021 20:05
Cross-OS compatibility with GNU tools (readlink, sed, zcat, zless, zdiff, ...) for Mac OS X towards Linux
# 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'
@katowulf
katowulf / firebase_copy.js
Last active July 29, 2022 15:58
Move or copy a Firebase path to a new location
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); }
});
});
}