Skip to content

Instantly share code, notes, and snippets.

View TysonRayJones's full-sized avatar

Tyson Jones TysonRayJones

View GitHub Profile
@TysonRayJones
TysonRayJones / C_Linux_Memory_Profiler.md
Last active December 18, 2017 14:36
A guide on using the Linux process memory profiler in C

Measure memory of a Linux process in C

Get code from here.

The header file

#include "memorymeasure.h"

provides a single function getMemory which returns the current and peak,

@TysonRayJones
TysonRayJones / C_MMA_Assoc_Builder.md
Last active December 18, 2017 18:23
Generate Mathematica Associations in C

Generate Mathematica Associations in C

Get the code here.

The header file

#include "mmaformatter.h"

provides functions for converting C data structures to strings of Mathematica objects, and producing files which Mathematica can read through Get as an association.

@TysonRayJones
TysonRayJones / Py_Linux_Memory_Profiler.md
Last active December 15, 2021 02:29
Guide for using the python linux process memory profiler

Measure memory of a Linux process in Python

The module (found here)

from memorymeasure import get_memory

provides a single function get_memory which returns the current and peak, real and virtual memories (in bytes, accurate to ~kilobytes) used by your Python code's Linux process, in a dictionary. The same module but in C can be found here.

@TysonRayJones
TysonRayJones / Py_MMA_Formatter.md
Last active August 27, 2020 08:39
Guide to generating Mathematica objects from python

Convert Python structures to Mathematica structures

Get the code here.

The module

from mmaformatter import get_mma, save_as_mma

provides functions for converting Python floats, complex numbers, lists, tuples, sets and dictionaries to their corresponding Mathematica form,

@TysonRayJones
TysonRayJones / Py_SLURM_param_sweeper.md
Last active June 28, 2024 16:41
Guide to using the python script for generating param-sweeping SLURM submission scripts

SLURM param sweeper

Get the code here.

This python library generates SLURM submission scripts which launch multiple jobs to 'sweep' a given set of parameters; that is, a job is run for every possible configuration of the params.

For example, you might have a script which accepts parameters a, b and c, which you call (passing a=1, b=2, c=3) like

@TysonRayJones
TysonRayJones / SLURM_commands.md
Last active January 18, 2024 21:42
A list of useful SLURM commands

In addition to Harvard's fantastic list, we list some other convenient SLURM commands.


Delay an enqueued job from running

Useful for letting other enqueued jobs run without having to kill/re-run already running jobs. To delay for 7 days:

@TysonRayJones
TysonRayJones / site_custom_css.md
Created January 21, 2018 20:39
Custom CSS used on the qtechtheory site
/*
 * ======= GIST CUSTOMISATION
 * modifies how gists look on the resources page (in tabs)
 */
/* remove 'hosted by Github' footer (everywhere) */
.gist-meta {
  display: none;
}
@TysonRayJones
TysonRayJones / site_profile_view_posts_button.md
Created January 21, 2018 21:27
Html code added via shortcoder to add a posts button to researcher profiles
<input type="button" value="View Posts" onclick="redirToPosts();" style="background-color:#bdbdbd;" />

<script>
function redirToPosts() {
	var oldURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
	var newURL = oldURL + "?profiletab=posts";
	window.location.replace(newURL);
}
@TysonRayJones
TysonRayJones / mount_filesystem_osx.md
Last active April 25, 2024 19:46
Mount a remote filesystem in OSX

If you're manipulating files stored on a remote machine, such as ARCUS or ARCHER supercomputers, you can mount the remote file system and interact with the files as if they were stored on your own machine. This makes viewing, editing, and opening files in software on your computer a breeze.

To do this on OSX, first ensure you have homebrew installed. If brew is not recognised in Terminal, run

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"