Skip to content

Instantly share code, notes, and snippets.

View mattocci27's full-sized avatar

Masatoshi Katabuchi mattocci27

View GitHub Profile
@mattocci27
mattocci27 / docker-env.sh
Created January 17, 2022 06:41
docker env
#!/bin/bash
echo LOCAL_UID=$(id -u $USER) > .env
echo LOCAL_GID=$(id -g $USER) >> .env
@mattocci27
mattocci27 / entrypoint.sh
Created January 17, 2022 06:40
entry point for docker
#!/bin/bash
USER_ID=${LOCAL_UID:-9001}
GROUP_ID=${LOCAL_GID:-9001}
echo "Starting with UID : $USER_ID, GID: $GROUP_ID"
useradd -u $USER_ID -o -m app
groupmod -g $GROUP_ID app
export HOME=/home/app
@mattocci27
mattocci27 / benchmark.R
Created July 30, 2020 03:24
r benchmark for matrix calcualtion
sessionInfo()
system.time(m <- rnorm(10^8))
m2 <- matrix(m, nrow = 10^4)
system.time(m2 %*% m2)
@mattocci27
mattocci27 / download_to_archives.sh
Last active July 30, 2020 02:58
move files from Dropbox/Download to Dropbox/Archives/Y-M/
#!/bin/sh
set -e
DATE=$(date -I)
MONTH=${DATE%-*}
DIR=~/Dropbox/Archives/$MONTH
DL=~/Dropbox/Download
if [ ! -d $DIR ]; then
@mattocci27
mattocci27 / .radian_profile
Created May 10, 2020 02:55
radian_profile
# Do not copy the whole configuration, just specify what you need!
# see https://help.farbox.com/pygments.html
# for a list of supported color schemes, default scheme is "native"
options(radian.color_scheme = "native")
# either `"emacs"` (default) or `"vi"`.
options(radian.editing_mode = "vi")
# indent continuation lines
# turn this off if you want to copy code without the extra indentation;
@mattocci27
mattocci27 / makevars.sh
Last active October 25, 2017 17:56
Shell script to create R Makevars file for Linux and macOS
#!/bin/sh
MAKEVARS="CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function"
# for linux
if [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
MAKEVARS="${MAKEVARS} -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION"
# additional for mac
elif [ "$(uname)" == 'Darwin' ]; then
MAKEVARS="${MAKEVARS}