Skip to content

Instantly share code, notes, and snippets.

@baileythegreen
baileythegreen / .monitor_daemon
Last active February 18, 2021 10:38
This is a set of files used to monitor disk usage on a remote cluster with a SunGridEngine-type scheduler. It is designed to run as a daemon process with very low overhead, that runs periodic checks for how much of a group's space is being used. It is intended to catch runaway jobs before they can write Terabytes of meaningless textfiles, or to …
This file is only here so the gist will be named correctly. Ignore it.
@baileythegreen
baileythegreen / genetics_functions.py
Last active April 5, 2021 15:02
Dead useful code for genetics results.
import inspect
def add_snp(holder, type, key, *value):
holder[key] = type(*value)
def lineno():
"""Returns the current line number in our program."""
return "Line number %d: " % inspect.currentframe().f_back.f_lineno
def readin(file):
@baileythegreen
baileythegreen / twitter_alt-text_visible_on_hover.css
Created February 24, 2021 16:10
Make twitter photo alt-text visible on hover, have an indicator visible normally.
div[data-testid="tweetPhoto"]:not([aria-label="Image"]) {
margin: 0 !important;
}
div[data-testid="tweetPhoto"]:not([aria-label="Image"]):hover::after {
content: attr(aria-label);
width: 95%;
background: rgba(0,0,0,.75);
color: #fff;
padding: 10px;
font-family: sans-serif;
@baileythegreen
baileythegreen / colour_accessibility.md
Last active February 26, 2021 00:46
Notes from a talk on use of colour in science and how current methods are fairly inaccessible.

Notes from a talk on use of colour in science and how current methods are fairly inaccessible.

NB. Saying colour-blind is somewhat derogatory (also generally incorrect because achromatopsia is super-rare), so the better way is colour-vision impaired or, perhaps, spectrally-challenged.

Colour vision impairment simulators: www.vischeck.com http://colororacle.org

This site seems to have lots of different information and tools, but is also extremely chaotic: mkweb.bcgsc.ca/colorblind

@baileythegreen
baileythegreen / customise_matplotlib_font.py
Created May 20, 2021 23:49
Customising font options in matplotlib and Seaborn.
import sys, os, optparse
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.lines import Line2D
# may be necessary if you have to add fonts to the path (probably only applies if you've installed new ones)
matplotlib.font_manager._rebuild()
import matplotlib.font_manager
@baileythegreen
baileythegreen / custom-abstract.bst
Last active August 8, 2021 01:15
A modified `abstract.bst` that will display a DOI, and numbers references instead of showing the bibtex key.
% BibTeX bibliography style `abstract'
% by David Kotz dfk@cs.duke.edu
% March 1989, May 1993, November 1995, October 2000
% modified from
% BibTeX standard bibliography style `alpha'
% version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
% Copyright (C) 1985, all rights reserved.
% Copying of this file is authorized only if either
% (1) you make absolutely no changes to your copy, including name, or
% (2) if you do make changes, you name it something other than
@baileythegreen
baileythegreen / example_subfigures.tex
Last active September 8, 2021 12:08
Example of a figure with two subfigures that each take up half of a page (portrait layout). The commented \captionsetup lines were not needed, but are placed correctly to affect subcaptions.
\begin{figure}
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{Images/UKB1/Manhattans/total_femur_mh.pdf}
%\captionsetup{skip=15pt, width=.9\textwidth}
\subcaption[UKB1 femur length]{Femur length in UKB1}
\end{subfigure}
\vspace{1cm}
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{Images/UKB1/Manhattans/total_humerus_mh.pdf}
@baileythegreen
baileythegreen / .vimrc
Created October 1, 2021 13:21
Adding a syntax highlighting theme in vim
" not necessary for the theme file to work
set softtabstop=4
set shiftwidth=4
set expandtab
set nu
set mouse=n
" related to theme, but can be put in ~.vimrc, or run in vim as desired
syntax on
set termguicolors=on
@baileythegreen
baileythegreen / uss_benefit_modeller_assumptions.md
Created March 14, 2022 17:12
Assumptions made by the modeller the USS pension scheme advertises during the ongoing pension disputes in the UK (March 2022).

Important notes and disclaimer

The assumptions on which this modeller is based do not reflect the JNC’s recommendation, which has been approved by the USS Trustee Board, regarding the temporary suspension to the reduction of the cap on pre and post retirement increases to Retirement Income Builder benefits. The current increases cap will continue to apply for most members on each increase date from 1 April 2023 until 1 April 2025 on Retirement Income Builder benefits accrued on and from 1 April 2022 up to and including 31 March 2024. Further details of the current increases cap and the temporary suspension are outlined in the notice that you have received from USS setting out the agreed changes. The temporary suspension is subject to the Trustee’s consultation with Universities UK on the statutory funding documents.

Purpose

This benefit comparison modeller (“modeller”) has been created to provide you with the opportunity to compare your estimated future pension benefits in USS under the current scheme s

@baileythegreen
baileythegreen / platypus.md
Created March 18, 2022 11:01
An explanation of how science actually works in practice

A recent thread about the platypus from @vagina_museum gave a great example of biological realities refusing to conform to categories humans delineate and of our scientific understanding of reality evolving when new evidence is presented.

I'd like to expand on how this actually works when we conduct research.

The scientific endeavour is predicated upon our ability to accept new information that goes against the current understanding and come away with a more complete understanding of how things actually are.

This does not mean that at any point we fully understand anything.

New information will always arise with advances in technology, discoveries, and people entering the field.