Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Royle quantixed

View GitHub Profile
@quantixed
quantixed / discogsGenresStyles.csv
Created Aug 26, 2022
Discogs database Styles with parent Genre
View discogsGenresStyles.csv
Genre Style
Blues Boogie Woogie
Blues Chicago Blues
Blues Country Blues
Blues Delta Blues
Blues East Coast Blues
Blues Electric Blues
Blues Harmonica Blues
Blues Hill Country Blues
Blues Jump Blues
@quantixed
quantixed / optimal-grant-proposals.csl
Created Aug 8, 2022
An alternative citation style layout for UKRI grant proposals, for when you have a bit more space
View optimal-grant-proposals.csl
<?xml version="1.0" encoding="UTF-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">
<info>
<title>Optimal style for grant proposals</title>
<!--<id>http://csl.mendeley.com/styles/20448741/minimal-grant-proposals</id>-->
<id>http://www.zotero.org/styles/optimal-grant-proposals</id>
<link href="http://www.zotero.org/styles/optimal-grant-proposals" rel="self"/>
<author>
<name>Anton Crombach</name>
<email>anton.crombach@gmail.com</email>
@quantixed
quantixed / minimal-grant-proposals.csl
Last active Jun 8, 2022 — forked from antoncrombach/minimal-grant-proposals.csl
Updated to match my preferred UKRI application style
View minimal-grant-proposals.csl
<?xml version="1.0" encoding="UTF-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">
<info>
<title>Minimal style for grant proposals</title>
<!--<id>http://csl.mendeley.com/styles/20448741/minimal-grant-proposals</id>-->
<id>http://www.zotero.org/styles/minimal-grant-proposals</id>
<link href="http://www.zotero.org/styles/minimal-grant-proposals" rel="self"/>
<author>
<name>Anton Crombach</name>
<email>anton.crombach@gmail.com</email>
@quantixed
quantixed / FitCircleTo2DCoords.ipf
Created May 24, 2022
Igor function to fit a circle to 2D coords (sparse, irregular, arc). Returns the radius in units of xy
View FitCircleTo2DCoords.ipf
Function FitCircleTo2DCoords(w)
Wave w
// requires 2D numeric wave with two columnns corresponding to xy coords
if(Dimsize(w,1) != 2)
return -1
endif
// make two 1D waves for x and y coords
SplitWave/O/NAME="xW;yW;" w
Wave xW,yW
// solve in terms of u and v coordinates
@quantixed
quantixed / pngSizeForOverleaf.ijm
Created Apr 22, 2021
Deduce the page width size needed for a 300 dpi png
View pngSizeForOverleaf.ijm
/*
* Figure out the width of png images for Overleaf
* png are 300 dpi and page width is 170 mm
*/
#@ File (label = "Input directory", style = "directory") input
#@ String (label = "File suffix", value = ".png") suffix
setBatchMode(true);
processFolder(input);
@quantixed
quantixed / config.ini
Created Aug 29, 2020
TexStudio v3.0.0 excerpt of config.ini file before [texmaker] - puts back zenburn coloring on macOS in dark mode
View config.ini
[General]
IniMode=true
[formats]
data\align-ampersand\bold=true
data\align-ampersand\fontFamily=
data\align-ampersand\foreground=#dc8cc3
data\align-ampersand\italic=false
data\align-ampersand\overline=false
data\align-ampersand\pointSize=0
@quantixed
quantixed / ExportDocsAsPNG.jsx
Last active Aug 29, 2020
Export ai files to PNG with our preferred settings for manuscript figures
View ExportDocsAsPNG.jsx
/****************************************************************
* Script to save a directory of ai files to PNG
* Options are: white bakcground, 300 dpi and clipped to artboard
*****************************************************************/
var folder = Folder.selectDialog();
if (folder) {
var files = folder.getFiles("*.ai");
for (var i = 0; i < files.length; i++) {
var currentFile = files[i];
app.open(currentFile);
@quantixed
quantixed / r_project_setup.R
Created Jun 10, 2020
Preferred directory structure for R projects
View r_project_setup.R
## Setup preferred directory structure in wd
ifelse(!dir.exists("Data"), dir.create("Data"), "Folder exists already")
ifelse(!dir.exists("Output"), dir.create("Output"), "Folder exists already")
ifelse(!dir.exists("Output/Data"), dir.create("Output/Data"), "Folder exists already")
ifelse(!dir.exists("Output/Plots"), dir.create("Output/Plots"), "Folder exists already")
ifelse(!dir.exists("Script"), dir.create("Script"), "Folder exists already")
@quantixed
quantixed / spindleSaver.ijm
Last active Mar 9, 2020
short macro to save a cell of interest (one frame from a two channel movie)
View spindleSaver.ijm
/*
* Short routine to save a single timepoint from a 2 channel movie
* Used for knocksideways spindle analysis
* Best done with "click ROI" square ROI over cell of interest
*/
dir = getDirectory("home")+"Desktop"+File.separator
winName = getTitle();
sliceNo = round(getSliceNumber() / 2);
s = "title=[tempwin] duplicate frames=" + d2s(sliceNo,0);
run("Duplicate...", s);
@quantixed
quantixed / haversine.ipf
Last active Oct 6, 2020
Calculates distance between two points using latitude and longitude in decimal degrees - IGOR Pro
View haversine.ipf
// calculates spherical distance between two points on earth given coords in decimal degrees
// uses haversine formula
// radius of earth is taken to be 6371 km (IUGG/WGS-84 mean)
Function SphericalDistanceBetweenTwoPoints(lat1, long1, lat2, long2)
Variable lat1, long1, lat2, long2
// convert inputs in degrees to radians
lat1*= pi/180
long1*= pi/180
lat2*= pi/180