Skip to content

Instantly share code, notes, and snippets.

View michael-ford's full-sized avatar

Michael Ford michael-ford

  • National Cancer Institute
  • USA
View GitHub Profile
[alias]
unstage = reset HEAD --
changed = "!git diff-tree --no-commit-id --name-only -r $2"
tree = log --graph --all --oneline
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
locate = ! git log --follow --all --remotes -3 --pretty=format:'%h' -- $1 | xargs -I_ git show --abbrev-commit --stat _
test = ! git log --follow --all --remotes -3 --pretty=format:'%h' -- "$1"
ss = "!f() { default=$(date '+Staged Stash: %Y-%m-%d %I:%M %p'); msg=${1-$default}; git stash push -m \"$msg\" -- $(git diff --staged --name-only); }; f"
diff-f = diff --name-status
cp = cherry-pick
@michael-ford
michael-ford / get-jupyter-url.sh
Created July 31, 2024 17:37
Print URL for jupyter session on biowulf
#!/bin/bash
result=""
while [[ -z "$result" ]]; do
result=$(jupyter server list 2> /dev/null | grep http | cut -f1 -d' ')
sleep 1
done
echo "$result"
@michael-ford
michael-ford / jupyter-tmux.sh
Created July 31, 2024 17:34
Script to start jupyter session on biowulf
#!/bin/bash
port=$(/usr/local/slurm/bin/reconnect_tunnels --list 2> /dev/null)
tmux new-session -d -s jupyter
tmux send-keys -t jupyter "cd /data/$USER; jupyter lab --no-browser --port=$port" C-m
tmux new-session -d -s main
sleep 5
tmux send-keys -t main "cd-data; get-jupyter-url.sh" C-m
@michael-ford
michael-ford / start-interactive.sh
Created July 31, 2024 17:27
Script for starting interactive session on Biowulf
sinteractive --mem=40g --cpus-per-task=16 --tunnel --time 36:00:00
@michael-ford
michael-ford / optimization-solver-wrapper.py
Created October 4, 2023 19:17
Modular python wrapper for ILP solvers
import importlib
from abc import ABCMeta, abstractmethod
from typing import Literal
class NoSolutionsError(Exception):
"""Raised if a model is infeasible."""
pass
class SolverMeta(metaclass=ABCMeta):
@michael-ford
michael-ford / .tmux.conf
Created March 27, 2023 18:23
Tmux Config
# Set Tmux's default keystroke to C-a, a binding which comes from GNU Screen
# and is quite commong among Tmux users.
set-option -g prefix C-a
unbind C-b
# fix emacs C-a
bind a send-prefix
# Better colors
set -g default-terminal "screen-256color"
@michael-ford
michael-ford / conda_env_export.py
Created March 3, 2021 21:46 — forked from gwerbin/conda_env_export.py
Export a Conda environment with --from-history, but also append Pip-installed dependencies
"""
Export a Conda environment with --from-history, but also append
Pip-installed dependencies
Exports only manually-installed dependencies, excluding build versions, but
including Pip-installed dependencies.
Lots of issues requesting this functionality in the Conda issue tracker, no
sign of progress (as of March 2020).
@michael-ford
michael-ford / presentation.html
Last active June 17, 2020 18:42
Project Design and Tools for Reproducibility
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html class="sl-root decks export loaded ua-phantomjs>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>deck: Slides</title>
<meta name="description" content="Slides">
@michael-ford
michael-ford / fetch_reads_and_map.sh
Last active January 6, 2019 22:59
Fetch Reads from EBI-ENA via Aspera and Map to Reference
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@michael-ford
michael-ford / git-cheatsheet.md
Last active December 28, 2018 18:45 — forked from hofmannsven/README.md
My simply Git Cheatsheet