Skip to content

Instantly share code, notes, and snippets.

View pansapiens's full-sized avatar

Andrew Perry pansapiens

  • Melbourne, Australia
View GitHub Profile
@pansapiens
pansapiens / .bashrc
Last active March 14, 2026 22:50
Some SLURM aliases
alias default_account='sacctmgr --parsable2 show user -s andrewpe | tail -1 | cut -f 2 -d '\''|'\'''
alias fairshare='sshare -a --accounts $(default_account)'
alias jhistory='sacct -u ${USER} --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname,partition,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist'
alias jshow='scontrol show job'
alias jinfo='sacct --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname%64,partition,qos,ReqCPUS,ReqMem,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist -j'
alias node_types='sinfo -o '\''%c %m %n %R'\'' --sort '\''P'\'''
alias qhogs='sreport cluster UserUtilizationByAccount -t hours'
alias si='sinfo -o "%20P %5D %14F %8z %10c %10m %10d %11l %16f %N"'
alias sq='squeue -o "%8i %.60j %4t %10u %20q %20a %10g %20P %10Q %5D %2C %5m %11l %11L %R"'
alias squ='squeue -u $USER --format="%.18i %.9P %.60j %.8u %.8a %.2t %.10M %.6D %R"'
@pansapiens
pansapiens / sif2docker.sh
Created March 11, 2025 20:22
Convert a Apptainer/Singularity SIF file to a Docker image.
#!/bin/bash
set -euo pipefail
function show_usage() {
echo "Usage: $0 <input.sif> [docker_image_name:tag]"
echo
echo "Converts a Apptainer/Singularity SIF file to a Docker image."
echo
echo "Arguments:"
@pansapiens
pansapiens / Dockerfile
Last active September 23, 2025 21:01
bcl-convert in Docker / Singularity
FROM centos:7
#
# You'll need to download bcl-convert-3.6.3-1.el7.x86_64.rpm from
# https://support.illumina.com/downloads/bcl-convert-downloads.html
# Yay clickwrap licenses !
#
# Building:
#
# docker build -t bcl-convert:latest -t bcl-convert:3.6.3 .
# sudo singularity build bcl-convert.sif docker-daemon://bcl-convert:latest
@pansapiens
pansapiens / views.py
Created February 20, 2018 01:26
Django REST Framework CSV parser, RFC 4180
from typing import Dict, List
import csv
from rest_framework import status
from rest_framework.response import Response
from rest_framework.parsers import JSONParser, BaseParser
from rest_framework.views import APIView
class CSVTextParser(BaseParser):
"""
A CSV parser for DRF APIViews.
@pansapiens
pansapiens / _README.md
Last active May 29, 2025 21:37
The Aspera ascp key you are looking for

Installing and running ascp is a PITA.

Here's the private key you need (at least for NCBI/ENA downloads).

ascp is now available in a Docker container. This makes things easier.

Do this:

# We need the not-actually-secret private key that comes packaged with Aspera Connect but is inexplicably not used as the default
# when no key is specified. Here's one I prepared earlier.

How to get firmware onto mutable modules

On Ubuntu 20.04.

(I have not yet tried the Black Magic Probe and gdb parts)

Install compiler

First install the arm compiler:

@pansapiens
pansapiens / barp2600_pitch_bend_range.py
Created March 29, 2025 06:24
Change the Behringer 2600 pitch bend range with sysex
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "mido",
# "python-rtmidi",
# ]
# ///
import mido
import argparse
@pansapiens
pansapiens / standalone_html.py
Last active March 27, 2025 14:29
Convert HTML to a self contained file with inline Base64 encoded PNG images
#!/usr/bin/env python
# A simple script to suck up HTML, convert any images to inline Base64
# encoded format and write out the converted file.
#
# Usage: python standalone_html.py <input_file.html> <output_file.html>
#
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML
import os
from bs4 import BeautifulSoup
@pansapiens
pansapiens / hmmer_tblout_parser.py
Last active February 20, 2025 21:45
HMMER tblout / domtblout to pandas.DataFrame
#!/usr/bin/env python
# MIT License
# Copyright (c) 2022 Zebulun Arendsee (rhmmer code)
# Copyright (c) 2025 Andrew Perry (port to Python)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@pansapiens
pansapiens / ollama-export.sh
Last active January 25, 2025 03:19 — forked from supersonictw/ollama-export.sh
Ollama Model Export Script
#!/bin/bash
# Ollama Model Export Script
# Usage: bash ollama-export.sh vicuna:7b
# License: MIT (https://ncurl.xyz/s/o_o6DVqIR)
# https://gist.github.com/supersonictw/f6cf5e599377132fe5e180b3d495c553
set -e
echo "Ollama Model Export Script"
echo "License: MIT (https://ncurl.xyz/s/RD0Yl5fSg)"