Skip to content

Instantly share code, notes, and snippets.

View willfurnass's full-sized avatar

Will Furnass willfurnass

View GitHub Profile
@willfurnass
willfurnass / paramiko_test.py
Last active February 11, 2022 11:12
Submitting a job to a remote Grid Engine cluster using Paramiko (Python SSH client)
import tempfile
import os
import time
import paramiko
# Hostname of a 'submission host' in the Grid Engine cluster we want to submit a job to
hostname = 'sharc.shef.ac.uk'
# Username for logging in to the cluster via SSH
username = "te1st"
@willfurnass
willfurnass / jsv_crlf_rejecter.tcl
Created April 9, 2018 12:46
Grid Engine JSV snippet to reject jobs containing CRLF
#!/usr/bin/tclsh
set sge_root $env(SGE_ROOT)
source "$sge_root/util/resources/jsv/jsv_include.tcl"
proc jsv_on_start {} {
jsv_send_env
}
proc lexists name {
@willfurnass
willfurnass / export_data.py
Created February 20, 2019 18:00
Python snippet to export data to a file in a particular format
import os
from typing import Dict
import numpy as np
def export_data(data: Dict[np.ndarray],
filename: str,
cols_per_line: int = 8) -> None:
"""Export dictionary of 1d float arrays to a file.
@willfurnass
willfurnass / python_debug_env.md
Last active August 25, 2020 17:08
Setting up a Python debug environment to investigate a segfaulting Python C extension

Notes on setting up a Python debug environment

Used to investigate a segfault in a Python C extension within a Python package.

  1. Install debug Python build using pyenv then check is available for use:

    pyenv install -g 3.8.5
    pyenv versions