Skip to content

Instantly share code, notes, and snippets.

View eschen42's full-sized avatar

Arthur Eschenlauer eschen42

View GitHub Profile
# LCTboot_inspect - TestCor::LCTboot modified:
# - to return a "reportables" data.frame as an attribute of the result
# - (for estimating the adjusted and unadjusted p-values)
# - to return the function environment as an attribute of the result
# - (for debugging reportables)
# - to use the normal approximation when Nboot == 0
# - (so that the same code base may be used for LCT-N and LCT-B)
# ref: https://github.com/cran/TestCor/blob/9d5d2a9a1ac284e3346bd144776559cbd82a8b52/R/FdrMethods.R
#' Bootstrap procedure LCT-B proposed by Cai & Liu (2016) for correlation testing.
#'
@eschen42
eschen42 / wsl2-reset.md
Created October 21, 2022 07:58 — forked from kiransubash/wsl2-reset.md
Reset WSL2 networking on windows 10

Open Powershell or Cmd as Administrator and run the following commands

wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
@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
@eschen42
eschen42 / another old windows _vimrc
Last active October 10, 2022 12:36
my old Windows _vimrc
set nocompatible
" source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/gvimrc_example.vim
" source $VIMRUNTIME/mswin.vim
behave xterm
set selectmode=mouse
set guifont=Courier:h9
" Cursor is Magenta
highlight Cursor guibg=Magenta guifg=NONE
au BufNewFile,BufRead *.mzXML set ft=xml
@eschen42
eschen42 / co_ject.icn
Created October 7, 2022 20:30
simple "co-expressions as objects" prototype
procedure co_foo(state, args[])
return .(state[args[1]] +:= args[2])
end
procedure co_new()
local state, foo, msg
state := table()
state["something"] := 1
@(
foo := create (
@eschen42
eschen42 / staque.R
Last active September 29, 2022 18:22
staque.R - Icon-oriented stack and queue operations
# staque.R - Icon-oriented stack and queue operations
# - queue:
# - sq_push/sq_pull to pass values thru vector left-to-right;
# - sq_put/sq_pop to pass values thru vector right-to-left.
# - stack:
# - sq_push/sq_get to left end of vector;
# - this is an "upward-growing stack";
# - in Icon, get is a synonym for pop; however base::get exists in R.
# - sq_put/sq_pull to right end of vector;
# - this is a "downward-growing stack".
@eschen42
eschen42 / pingstat.icn
Last active August 21, 2022 20:37
pingstat.icn - compute statistics for unix ping output
#!/bin/env icon
############################################################################
#
# File: pingstat.icn
#
# Subject: pingstat.icn - compute statistics for unix ping output
#
# Author: Arthur Eschenlauer (https://orcid.org/0000-0002-2882-0508)
#
# Date: 21 August, 2022
@eschen42
eschen42 / header.icn
Last active August 21, 2022 20:26
Icon standard header
############################################################################
#
# File: [progname].icn
#
# Subject: [progname].icn - [subtitle succinctly describing what progname.icn is or does]
#
# Author: Arthur Eschenlauer (https://orcid.org/0000-0002-2882-0508)
#
# Date: [e.g. 26 March, 2020]
#
@eschen42
eschen42 / fgrep.R
Created August 8, 2022 21:40
Emulate fgrep in R, i.e., is any of needles found in any of haystacks
#' Emulate fgrep, i.e., is any of needles found in any of haystacks
#'
#' This should perform adequately for a few needles.
#'
#' If performance for many needles is inadequate, use
#' `0 < length(AhoCorasickTrie::AhoCorasickSearch(needles, haystacks)[[1]])`
#' as the implementation for a more realistic emulation of fgrep.
#'
#' @param needles A character vector of length 1 or more
#' @param search_strings A character of length 1 or more
@eschen42
eschen42 / tabCount.icn
Last active December 29, 2021 16:57
Count tabs per line; flag when number differs from number in first line
# Count tabs per line; flag when number differs from number in first line
#
# Execute with `icon tabCount.icn tsv_file -1`
# See [the Icon website](https://cs.arizona.edu/icon) for further info about the Icon programming language.
#
procedure main(args)
# args[1] = input file
# args[2] = number of lines (optional, default = 3)
local expected
local input_file