Skip to content

Instantly share code, notes, and snippets.

View wwarriner's full-sized avatar

William Warriner wwarriner

  • University of Alabama at Birmingham
  • Birmingham, AL
View GitHub Profile
@wwarriner
wwarriner / dask_image_watershed.ipynb
Last active November 26, 2019 20:08
First attempt at distributed watershed
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wwarriner
wwarriner / List_of_ENV_in_Windows.md
Created January 22, 2020 15:48 — forked from pkfrom/List_of_ENV_in_Windows.md
List of Environment Variables in Windows Operating System.

List of Environment Variables in Windows Operating System

Windows XP Environment Variables

Environment Variable Path
%ALLUSERSPROFILE% C:\Documents and Settings\All Users
%APPDATA% C:\Documents and Settings{username}\Application Data
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files

The properties function of MATLAB dynamicprops handle classes is not returned in sorted order, and isn't even self-consistent. Multiple class initializations followed by clear classes can return different orders each time. Since R2018b (and maybe earlier) one can do the following to return properties in sorted order.

Add public overrides for properties and fieldnames like below. Technically properties() isn't a method of handle dynamicprops, but this should still work because methods are called before built-ins (https://www.mathworks.com/help/matlab/matlab_prog/function-precedence-order.html).

function value = properties( obj )
    if nargout == 0
        disp( builtin( "properties", obj ) );
    else
        value = sort( builtin( "properties", obj ) );
@wwarriner
wwarriner / .zshrc
Last active September 29, 2022 04:13
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
@wwarriner
wwarriner / bash_strict_mode.md
Created October 20, 2022 16:39 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

Hex Codes for Nature letter "Points of view: Color blindness"

Hex codes for https://www.nature.com/articles/nmeth.1618.

Name R G B HEX
Black 0 0 0 #000000
Orange 230 159 0 #E69F00
Sky Blue 86 180 233 #56B4E9
Bluish Green 0 158 115 #009E73
@wwarriner
wwarriner / env.yml
Last active June 14, 2023 22:50
How to: use Python with sqlalchemy into postgresql
name: sqlalchemy
channels:
- conda-forge
dependencies:
- pandas=2.0.2
- pip=22.3.1
- python=3.10.9
- sqlalchemy=1.4.39
- pip:
- psychopg2-binary==2.9.6
@wwarriner
wwarriner / .bashrc
Created July 14, 2023 16:23
History improvements for .bashrc
# History extensions
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=1000
export HISTFILESIZE=100000
export HISTTIMEFORMAT='%F %T ' # Include history time stamps
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
@wwarriner
wwarriner / latency.txt
Created October 12, 2023 16:57 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@wwarriner
wwarriner / latency.markdown
Created October 12, 2023 17:10 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs