Skip to content

Instantly share code, notes, and snippets.

@NeutralKaon
NeutralKaon / Extracty.R
Created October 16, 2023 23:16
Extract EndNote citations from a word document
library(xml2)
library(magrittr)
library(RCurl)
# This is a clean room reverse-engineered for compatibility and interoperability crude-yet-effective extractor for embedded citations created by end note in a word document. This is useful if you wish to e.g. rewrite the word document in LaTeX and import the same citations en block (via xml).
# EC 2009/24/EC states "The person having a right to use a copy of a computer program shall be entitled, without the authorisation of the rightholder, to observe, study or test the functioning of the program in order to determine the ideas and principles which underlie any element of the program if he does so while performing any of the acts of loading, displaying, running, transmitting or storing the program which he is entitled to do."
# Don't sue me!
# So, to extract references from a word document sent to you:
#docx <- yourdocx
@NeutralKaon
NeutralKaon / TMS-Hax.js
Created March 5, 2022 22:09
Oxford TMS quality of life improvements.
// ==UserScript==
// @name TMS-Hax
// @namespace https://tms.ox.ac.uk tms.ox.ac.uk
// @description Quality of life hax
// @include https://tms.ox.ac.uk/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
// This is a quality of life script for the rather unfortunately terrible site tms.ox.ac.uk
// Use with greasemonkey or tampermonkey
@NeutralKaon
NeutralKaon / CreateGhidraApp.sh
Last active September 2, 2021 23:49 — forked from saagarjha/CreateGhidraApp.sh
Creates a Ghidra.app bundle for macOS
#!/bin/sh
set -eu
create_iconset() {
mkdir -p Ghidra.iconset
cat << EOF > Ghidra.iconset/Contents.json
{
"images":
[
// ==UserScript==
// @name ISMRM Video Fixer
// @namespace ismrm-video-fixer
// @version 8
// @description Removes the attribute controls=false of the video tag in pathable.com for ISMRM's conference in 2021, permitting the user to do useful things, e.g. speed them up.
// @author jack.miller@physics.org
// @include https://*.pathable.com/*
// @run-at document-idle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
Country Code Population Year
ABW 105366 2017
AFG 36296400 2017
AGO 29816748 2017
ALB 2873457 2017
AND 77001 2017
ARB 411898967 2017
ARE 9487203 2017
ARG 44044811 2017
ARM 2944809 2017
@NeutralKaon
NeutralKaon / read_dsv.m
Last active August 3, 2023 06:55
A matlab routine for reading Siemens IDEA / POET .dsv pulse sequence directories / files
function out=read_dsv(pathname)
% Read a Siemens IDEA DSV folder as simulated by POET, for subsequent plotting.
% This just parses a pre-existing text file and plonks it into a struct.
%
% Input: a POET-simulated folder containing .dsv files (check your temp
% files in an IDEA VM)
%
% Output: a returned structure containing the parsed contents present.
%
% Should you wish to plot a pulse sequence diagram, you probably want to
#!/usr/bin/python3
# JJM -- parse cvi42 / cmr42 xml reports and extract relevant cardiac parameters
# Plonk them into a csv file for later dealings (in R)
# Supposedly biologist friendly.
import sys
import csv
from bs4 import BeautifulSoup
multiplyFlag = True
@NeutralKaon
NeutralKaon / hostapd.conf
Created August 28, 2020 20:45
Hostapd.conf configuration for the ath9k-driven TP-Link TL-WDN4800 N900 PCI-e wifi card
##### hostapd configuration file ##############################################
# Empty lines and lines starting with # are ignored
# AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
# management frames with the Host AP driver); wlan0 with many nl80211 drivers
# Note: This attribute can be overridden by the values supplied with the '-i'
# command line parameter.
interface=wlp3s0
# In case of atheros and nl80211 driver interfaces, an additional
@NeutralKaon
NeutralKaon / iTunes_Control.sh
Created April 7, 2020 08:33
Control iTunes from the command line -- forked from rkumar
#!/bin/bash
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 rahul kumar
####################################
showHelp () {
#Helper function to plot a simple linear regression line over a facet_wrap grid with ggplot2
stat_smooth_func <- function(mapping = NULL, data = NULL,
geom = "smooth", position = "identity",
...,
method = "auto",
formula = y ~ x,
se = TRUE,
n = 80,
span = 0.75,
fullrange = FALSE,