Skip to content

Instantly share code, notes, and snippets.

View CatChenal's full-sized avatar

Cat Chenal CatChenal

View GitHub Profile
@CatChenal
CatChenal / gomacs.md
Last active December 4, 2023 18:10
Detailed and revised commands for GROMACS installation in Ubuntu-20.04 (WSL2)

Commands sequence:

tar xfz gromacs-2023.3.tar.gz
cd gromacs-2023.3
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make
make check
@CatChenal
CatChenal / standage_gv.md
Last active February 2, 2023 20:36
Graphviz decision tree redrawn from @standage
@CatChenal
CatChenal / conda_pkg_deps_from_WSL.md
Last active February 5, 2023 20:41
WSL-Bash script to get a conda package dependents on Windows mount

Main bash script:

  • Note: this is a work around for using linux scripting (grep/sed/awk) via WSL2 on an Windows OS target (../../mnt)
    ...without installing anything.

Contents of conda_pkg_deps.sh:

#!/bin/sh
#
# Find which package in the conda package cache requires the given package.
# To be run in home folder:~$ 

The easiest way I found to create an empty file in Windows 10 like touch in Linux:

>cd . > filename.ext
@CatChenal
CatChenal / env_with_kernel.md
Last active September 20, 2023 19:48
Conda environment creation & kernel installation

Conda environment creation & kernel installation

Update: A simpler alternative is to install nb_conda_kernels, which makes accessible all defined environments.

Two commands to run when creating a new env:

# 1. Env creation: always include ipykernel (could be place in .condarc)
conda create --name env310 python=3.10 ipykernel numpy
# 2. Kernel installation: makes env available in jupyter's kernels list
python -m ipykernel install --user --name=env310 --display-name "py310"
@CatChenal
CatChenal / bare_conda_env.md
Last active September 2, 2022 18:23
What a conda environment contains when created with only python & Command to exclude packages listed in .condarc `create_default_packages`.

Using the Anaconda Prompt on a Windows 10 system:

This is the conda command that creates a new environment with only python installed while excluding
any listed packages under the create_default_packages section of user root folder\.condarc:

(base) [PS1]>conda create -n bare310 --no-default-packages python=3.10

The output (minus a few blank lines):

Collecting package metadata (current_repodata.json): done
@CatChenal
CatChenal / clear_unused_axes.md
Last active July 27, 2022 18:05
When populating a grid of mpl axes with unknown actual number of datasets, some axes may be empty: clear them AFTER the main loop.

Tip: when populating a grid of mpl axes with unknown actual number of datasets, some axes may be empty: clear them AFTER the main loop.

Code source: DETR_panoptic notebook on colab

  • In the enumerated loop below, we don't know where i will end (because out["pred_masks"][keep] was not saved into a variable, hence we can't access its length).
  • We then use the main loop index into a second one to clear any empty axis.
#[...]
@CatChenal
CatChenal / h_candle_plot.md
Last active July 27, 2022 19:57
Candle plot for two series with categorical y-axis

candle

Data points and sample figure to replicate in E. Downey's plotting

import matplotlib.pyplot as plt

sandwich_list = [
    'Lobster roll',
    'Chicken caesar',
@CatChenal
CatChenal / ipywidgets_interact.md
Last active August 8, 2023 15:24
Some flavors of `ipywidgets.interact[]` require a print statement in the dependent function

Example 1 - Simplest implementation: using interact:

=> No need for the function to have a print/display statement => This should also be the behavior of interactive & interactive_output, but it's not

import ipywidgets as ipw


@ipw.interact(x=(20.,250.,5),
          a=(-60.,60.,10),
          b=(-6_000.,6_000,100))
@CatChenal
CatChenal / update_git.md
Last active May 2, 2022 15:14
How to update git at the command line

I used to command line version given in this SO post to upgrade my current git version:

  1. Check current version:
(base) C:\Users\me>git --version
git version 2.34.1.windows.1
  1. Update if necessary, which it is for any version below 2.35 as per this offical announcement from 2022-04-12:
(base) C:\Users\me>git update-git-for-windows