Skip to content

Instantly share code, notes, and snippets.

@coltonbh
coltonbh / terachem-shell-command.sh
Last active June 14, 2023 04:41
A simple shell command to run a TeraChem container as if a local command.
# Create terachem command to run the container as if a system command
export TERACHEM_IMAGE="mtzgroup/terachem:1.9-2021.12-dev-cuda11.4-sm_52-sm_80"
export TERACHEM_LICENSE_PATH="" # Add absolute path to license, if you have one.
terachem() {
# Get the current user's UID and GID
uid=$(id -u)
gid=$(id -g)
# Default port mapping
@coltonbh
coltonbh / docker-swarm-gpu.md
Last active May 6, 2024 21:04
Docker Swarm GPU Support

GPU Support For Docker Swarm

Docker compose has nice support for GPUs, K8s has moved their cluster-wide GPU scheduler from experimental to stable status. Docker swarm has yet to support the device option used in docker compose so the mechanisms for supporting GPUs on swarm are a bit more open-ended.

Basic documentation

@coltonbh
coltonbh / two_hop_ssh.md
Last active May 16, 2023 05:09
Two Hop SSH Login
  1. Create new ssh key

Change to ssh directory

cd ~/.ssh/

Create a new key. Give it a useful name (you are prompted for a name after you hit enter; leave passphrase blank)

ssh-keygen -t ed25519 -C "your_email@example.com"
@coltonbh
coltonbh / Switching to Linux (Ubuntu) for Total Beginners.md
Created December 15, 2021 19:19
Switching to Linux (Ubuntu) for Total Beginners

Switching to Linux (Ubuntu)

Applications

Applications for Linux come in a few varieties. You can install packages using the system package manager (apt), install snap packages, "install" (run) AppImage applications, run installer scripts offered by a particular application, download and unzip application (and place them in an appropriate directory), or install from source. I'll discuss each installation method, where files should be written to, how (if) they should be symlinked, and how to integrate them into your desktop environment.

Applications are usually installed into one of the following places:

  • ${HOME}/Applications for AppImage files. Then they are often integrated into your Desktop environment using [[#Create Desktop Icons for Applications|the instructions below]].
  • /opt/ is for add-on application software packages (link). This means software applications you add to your system like Julia, `

Keybase proof

I hereby claim:

  • I am coltonbh on github.
  • I am coltonbh (https://keybase.io/coltonbh) on keybase.
  • I have a public key ASAZsBTjMr4dkE5yWTSWaduZjqj3pOz2ygZymhHRPW75IAo

To claim this, I am signing this object:

@coltonbh
coltonbh / Django ABSMax Aggregator
Created April 2, 2018 19:07
For when an absolute value calculation of Max is needed. In this case the 'quantity' value could be negative or positive and I want the largest position from both the long (positive quantity) and short (negative quantity) positions.
from django.db.models import Max, FloatField
class ABSMax(Max):
"""Django annotate/aggregate method for computing the abs max value of
some expression.
"""
name = 'ABSMax'
template = '%(function)s(%(absolute)s(%(expressions)s))'
def __init__(self, expression, **extra):
#!/usr/bin/env python
# colton edits to make python3 compatible
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">