Skip to content

Instantly share code, notes, and snippets.

View eschen42's full-sized avatar

Arthur Eschenlauer eschen42

View GitHub Profile
@eschen42
eschen42 / Planemo-dev-workflow.svg
Last active July 5, 2019 15:43
My planemo process
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eschen42
eschen42 / set_up_usernetes_activate.sh
Last active September 11, 2019 12:12
usernetes activation script (save as usernetes/bin/activate and usernetes/.bash_env)
#!/bin/sh
if [ -z "$1" ]; then
echo "usage: $0 path/to/decompressed/usernetes/release/"
exit 1
fi
if [ ! -d "$1" ]; then
echo "usage: $0 path/to/decompressed/usernetes/release/"
echo "path '$1' does not exist"
exit 1
fi
@eschen42
eschen42 / bibbox_local_install.md
Last active March 5, 2019 22:17
Local installation of bibbox without using Vagrant

Installing bibbox locally - notes to self

Ensure locale is en_US.UTF-8 UTF-8

If the output of the locale command does not include the line

LC_ALL=en_US.UTF-8

then you may need to do the following:

@eschen42
eschen42 / ubuntu_ecryptfs_ssh.md
Created March 5, 2019 04:28
Public key SSH with eCryptFS home directory

Public key SSH with eCryptFS home directory

The goal

I want to SSH into an Ubuntu box with an encrypted home directory, and I prefer using publickey authentication.

The problem posed by an encrypted home

Ubuntu allows you to encrypt your own home directory. If you insist, as I do, that you use publickey authentication for your SSH authentication (which is nearly two-factor authentication as long as you protect your private ID key with a passphrase), this presents a problem: to authenticate, you need your ~/.ssh/authorized_keys file accessible, but when you are not logged in, it is inaccessible.

@eschen42
eschen42 / center_colmeans.R
Created November 30, 2018 15:20
R - Center a matrix on its column means
# center with 'colMeans()' - ref: http://gastonsanchez.com/visually-enforced/how-to/2014/01/15/Center-data-in-R/
center_colmeans <- function(x) {
xcenter <- colMeans(x)
x - rep(xcenter, rep.int(nrow(x), ncol(x)))
}
@eschen42
eschen42 / tty_columns_debian.sh
Created October 25, 2018 16:24
get tty columns on Debian
#!/usr/bin/env bash
export ROWCOL="$(stty -a | head -n 1 | grep columns | sed -n -e 's/speed [0-9]* baud; rows \([0-9]*\); columns \([0-9]*\);.*/export LINES=\1; export COLUMNS=\2 /; s/.*speed//; p')"
$ROWCOL
@eschen42
eschen42 / ApplyReduceMovingAverage.icn
Created October 13, 2018 01:20
Icon code for Apply, Reduce, and MovingAverage
procedure Apply(f, L)
local result, x
result := []
every x := !L do put(result, f(x)) | fail
return result
end
procedure Reduce(f, L)
if *L > 1
then return f( L[1], Reduce( f, L[2:0] ) )
@eschen42
eschen42 / bistable.icn
Last active October 13, 2018 01:31
Icon code for positive-edge triggered bistable multivibrator
procedure co_bistable(off_state, on_state)
local button, bistable_button, bistable_state
/off_state := "off"
/on_state := "on"
bistable_button := bistable_state := button := off_state
return create while button := (
if button ~== bistable_button
then if (bistable_button := button) == on_state
then bistable_state := if bistable_state == off_state
then on_state
@eschen42
eschen42 / which.cmd
Last active March 13, 2020 21:28
which for Windows
@set ERRORLEVEL=&setlocal&echo off
:: ref: https://gist.github.com/eschen42/dec433b73edf5090c62ffe854604bdf6
set ARG1=%1
if not defined ARG1 (
echo usage: "%~nx0" executable-name [/a]
exit /b -87
)
set ALL=FALSE
set ARG2=%2
if defined ARG2 (
@eschen42
eschen42 / _vimrc
Last active October 10, 2022 12:38
windows-oriented .vimrc
" make vim more useful at the expense of vim compatibility
set nocompatible
" source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/gvimrc_example.vim
" uncomment the next line to make ^C ^X ^V exchange data with the clipboard
"source $VIMRUNTIME/mswin.vim
" behave xterm
set selectmode=mouse
set guifont=Courier:h10
" Colorscheme peachpuff