Skip to content

Instantly share code, notes, and snippets.

View stevekm's full-sized avatar

Stephen Kelly stevekm

View GitHub Profile
@stevekm
stevekm / SLURM_vs_code_ssh_config.txt
Last active May 31, 2025 07:03
SSH config to allow VS Code Remote SSH to connect to a fresh new SLURM job running on a remote HPC system
# ssh config to use with VS Code Remote SSH
# to launch a VS Code remote ssh session inside of
# a new SLURM compute job running on the remote HPC
# when you start a new ssh session from your LOCAL laptop,
# SLURM will spin up a new srun job and connect to the ssh daemon on the compute node
# your ssh connection will thus tunnel from your LOCAL laptop
# through the head node, to the compute node
# the SLURM job on the compute node will remain active until it expires via time limit
# the SLURM job will terminate when the ssh session is closed
@stevekm
stevekm / gist:53265226545c8920153c906a61335fbf
Created May 7, 2025 15:07
install singularity from ap
apt-get install -y singularity-container=4.1.1+ds2-1ubuntu0.2
@stevekm
stevekm / 000-Cheat-Sheets.md
Created May 1, 2024 04:03 — forked from JoshuaEstes/000-Cheat-Sheets.md
Developer Cheat Sheets for bash, git, gpg, irssi, mutt, tmux, and vim. See my dotfiles repository for extra info.
@stevekm
stevekm / main.go
Created November 1, 2023 16:48
Go program to read and write a .gz file (fastq.gz)
package main
import (
"fmt"
// "compress/gzip"
gzip "github.com/klauspost/pgzip"
"bufio"
"os"
"log"
)
@stevekm
stevekm / gist:637897ececa2b493fd9b5b0ab91590dd
Created November 7, 2022 17:05
Python multiprocessing Pool apply_async example
#!/usr/bin/env python3
# do an action in parallel across multiple threads in Python
# example: get the average of lists of numbers
# references;
# https://stackoverflow.com/questions/8533318/multiprocessing-pool-when-to-use-apply-apply-async-or-map
# https://e2eml.school/multiprocessing.html
# https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.pool.Pool.apply_async
@stevekm
stevekm / Git-Diff.md
Last active September 9, 2021 14:52
git diff explanation & gdiff shortcut

A visual example for interpretting the output of git diff, along with a helper alias gdiff to make it easier to git diff two files or directories.

Example input files:

$ cat example1.txt
Sample1
Sample2
Sample3
Sample4
@stevekm
stevekm / email.py
Created July 8, 2021 20:25
Python helper module for writing and sending emails
#!/usr/bin/env python
"""
Module to send email messages
https://www.tutorialspoint.com/python/python_sending_email.htm
"""
import getpass
import smtplib
# default global configs
@stevekm
stevekm / run.sh
Created June 15, 2021 19:03
GNU parallel example command
parallel -k -N0 -n 0 -j 4 "echo your command here ; sleep 2" ::: {1..10}
@stevekm
stevekm / mac.md
Last active April 12, 2019 15:46
Mac Guide

Programs to install on your MacBook

Essentials

  • Application manager for OS X
  • some homebrew downloads you might need:
brew tap caskroom/cask
@stevekm
stevekm / squeue2json.py
Created December 5, 2018 22:59
Convert SLURM squeue output to JSON format
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Convert SLURM squeue output to JSON format
"""
import subprocess as sp
import json
process = sp.Popen(['squeue', '-o', '%all'], stdout = sp.PIPE, stderr = sp.PIPE, shell = False, universal_newlines = True)
proc_stdout, proc_stderr = process.communicate()