Skip to content

Instantly share code, notes, and snippets.

@sbamin
sbamin / life_in_weeks.html
Last active December 30, 2025 04:42
Life in Weeks chart by Tim Urban - customizable, preview: https://gistpreview.github.io/?6f11a4ffd036412992394383b67f110a/life_in_weeks.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Life in Weeks Chart</title>
<style>
:root {
--bg: #ffffff;
--text: #111827;
@ARTICLE{Bakas2020-ee,
title = "{iGLASS}: imaging integration into the Glioma Longitudinal
Analysis Consortium",
author = "Bakas, Spyridon and Ormond, David Ryan and Alfaro-Munoz, Kristin
D and Smits, Marion and Cooper, Lee Alex Donald and Verhaak, Roel
and Poisson, Laila M",
journal = "Neuro. Oncol.",
volume = 22,
number = 10,
@sbamin
sbamin / cytotable_0.0.1p2.def
Created September 20, 2023 18:53
cytotable apptainer def file - for debug only
Bootstrap: docker
From: python:3.10.11
Stage: build
%environment
export my_appimg="cytotable_0.0.1p2"
%labels
Maintainer sbamin
Image CytoTable
@sbamin
sbamin / config
Created May 5, 2023 17:29
Persistent SSH connection via SSH ControlMaster.
## add following to mac ~/.ssh/config file after required edits
## then do ssh mcclearybg to start background session, typically
## once per day. This will require duo push
## then you can start additional ssh by ssh mccleary (note: no suffix bg)
## More at https://docs.ycrc.yale.edu/clusters-at-yale/access/advanced-config/ and
## https://www.anchor.com.au/blog/2010/02/ssh-controlmaster-the-good-the-bad-the-ugly/
################## Yale ##################
# Uncomment the ForwardX11 options line to enable X11 Forwarding by default (no -Y necessary)
@sbamin
sbamin / 1_highlight.js
Last active May 3, 2023 21:05
ChatGPT way of highlighting text in a html page and extracting it in a text file. https://shareg.pt/dIVonZZ
javascript:(function(){
// via ChatGPT, https://shareg.pt/dIVonZZ
var highlights = [];
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = ".highlight { background-color: yellow !important; color: black !important; }";
document.getElementsByTagName("head")[0].appendChild(style);
document.addEventListener("mouseup", function() {
@sbamin
sbamin / run_sleep_mx
Last active April 28, 2023 19:00
toggle sleep mode for mac os ventura on M2 macbook, especially with unplugged power, monitors attached, and closed lid (closed diplay mode or clamshell).
#!/usr/bin/env bash
## Enable/Disable sleep on closed display
## strict mode on
set -euo pipefail
## can be one of status|on|off
cmd="${1:-"status"}"
@sbamin
sbamin / chkcpumem
Created March 10, 2023 17:23
Check CPU and Memory usage for a given user
#!/usr/bin/env bash
## Check CPU and Memory Usage for an USER
## @sbamin
## https://superuser.com/a/920158/213756
## default to current user unless an user is specified as
## a first positional argument.
userid="${1:-"${USER}"}"
@sbamin
sbamin / deno
Created April 18, 2022 23:03
Wrapper for deno while using it as a shared resource for Quarto framework, https://github.com/quarto-dev/quarto-cli/discussions/380
#!/usr/bin/env bash
# wrapper for running deno (dependency for Quarto) on Cent OS 7
# https://github.com/quarto-dev/quarto-cli/discussions/380
# this wrapper replaces default deno binary (at /share/deno)
# shipped with quarto pre-compiled binaries
# tested ok with https://github.com/quarto-dev/quarto-cli/releases/download/v0.9.254/quarto-0.9.254-linux-amd64.tar.gz
# on Cent OS 7, Linux 3.10.0-1062.1.2.el7.x86_64
@sbamin
sbamin / diskcheck.sh
Created January 23, 2022 02:45
Check disk quota prior to running workflows with 100s of jobs in queue
#!/usr/bin/env bash
## following will prevent running of queued jobs if tier 1 space is > 99 %
tstamp="$(date +%d%b%y_%H%M%S_%Z)"
## available files: tier1state.txt, tier2state.txt, faststate.txt
## These files updates every 30 min per disk status.
diskstat=$(cat /projects/verhaak-lab/verhaak_env/SetEnv/logs/diskstats/tier1state.txt)
diskstat=${diskstat:-"NA"}
@sbamin
sbamin / reset_path_variable_bash.sh
Last active November 5, 2021 21:31
Reset PATH in ~/.bash_profile such that PATH variable follows user-defined order of paths.
## add following to the end of ~/.bash_profile assuming ~/.bash_profile takes the precedence over ~/.profile (if present), ~/.bash_profile, or other bash configs.
## for zsh or other shells, you may need to tweak following code.
## Be careful "resetting" PATH variable and know the implications of PATH variable being either empty or missing critical system paths!
################################### SET PATH ###################################
## User specific environment and startup programs
## Rewriting PATH ##
## We want user and anaconda paths to precede system paths, esp. this string:
## /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin which contains
## most of system default libs,