Skip to content

Instantly share code, notes, and snippets.

Arthur Eschenlauer eschen42

Block or report user

Report or block eschen42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Planemo-dev-workflow.svg
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 Sep 11, 2019
usernetes activation script (save as usernetes/bin/activate and usernetes/.bash_env)
View set_up_usernetes_activate.sh
#!/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 Mar 5, 2019
Local installation of bibbox without using Vagrant
View bibbox_local_install.md

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 Mar 5, 2019
Public key SSH with eCryptFS home directory
View ubuntu_ecryptfs_ssh.md

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 Nov 30, 2018
R - Center a matrix on its column means
View center_colmeans.R
# 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 Oct 25, 2018
get tty columns on Debian
View tty_columns_debian.sh
#!/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 Oct 13, 2018
Icon code for Apply, Reduce, and MovingAverage
View ApplyReduceMovingAverage.icn
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 Oct 13, 2018
Icon code for positive-edge triggered bistable multivibrator
View bistable.icn
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
Created Sep 26, 2018
which for Windows
View which.cmd
@echo off
setlocal
:: make sure that there are no occurrences of ;; in target
set target=%PATH:;;=;%_END
:: make sure that target does not end with a semicolon
set target=%target:;_END=_END%
set target=%target:_END=%
:: prepend current directory and substitute dquote-space-dquote for ;
set target="." "%target:;=" "%"
for %%h in ( %target% ) do (
@eschen42
eschen42 / _vimrc_win
Last active Sep 26, 2018
windows-oriented .vimrc
View _vimrc_win
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:h9
" Cursor is Magenta
highlight Cursor guibg=Magenta guifg=NONE
You can’t perform that action at this time.