Skip to content

Instantly share code, notes, and snippets.

View kdm9's full-sized avatar
💭
Remind me if I don't respond

Dr. K. D. Murray kdm9

💭
Remind me if I don't respond
View GitHub Profile
@kdm9
kdm9 / get-annex.sh
Last active January 12, 2024 12:47
a curl-pipe-sh for installing git-annex on linux amd64
#!/bin/bash
set -xe
mkdir -p ~/.local/opt
cd ~/.local/opt
wget -O git-annex-standalone-amd64.tar.gz https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-amd64.tar.gz
rm -rf git-annex.linux
tar xvf git-annex-standalone-amd64.tar.gz
mkdir -p ~/.local/bin
ln -sf $PWD/git-annex.linux/{git,git-annex,git-annex-shell,git-receive-pack,git-upload-pack,git-shell} ~/.local/bin
@kdm9
kdm9 / as.numeric.verbose
Last active April 2, 2024 14:31
An `as.numeric()` in R that warns about non-numeric values
as.numeric.verbose = function(x) {
# this code will parse german-style comma-as-decimal numbers or
# english-style dot-as-decimal numbers.
x = ifelse(grepl('^\\d+,\\d+$', x, perl=T), sub(',', '.', x, fixed=T), x)
x.num = as.numeric(x)
# Find which values got coerced to NA
coerced = which(!is.na(x) & is.na(x.num))
if (length(coerced) > 0) {
cat("Following values coerced to NA:\n")
print(paste(coerced, x[coerced]))
@kdm9
kdm9 / 02.sh
Created June 17, 2020 00:39
git tutorial script 2
#!/bin/bash
echo "This is the Chromosome 4 finder script"
grep '^Chr2' data/genes.bed > data/chr4.bed
wc -l data/chr4.bed
dpkg-checkbuilddeps: error: Unmet build dependencies: python3-pytools
W: Unmet build-dependency in source
dpkg-buildpackage: info: source package snakemake
dpkg-buildpackage: info: source version 3.9.0+dfsg-1
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by Kevin Murray <kdmfoss@gmail.com>
dpkg-source --before-build snakemake
dpkg-source: info: applying 0001-Use-the-inbuild-sphinx.ext.napoleon.patch
dpkg-source: info: applying 0003-Use-debian-s-mathjax-package.patch
dpkg-source: info: applying 0003-Compat-fix.patch
#!/bin/bash
declare -A urls
urls[0.5]='https://s3.amazonaws.com/julialang/bin/linux/x64/0.5/julia-0.5-latest-linux-x86_64.tar.gz'
urls[nightly]='https://s3.amazonaws.com/julianightlies/bin/linux/x64/julia-latest-linux64.tar.gz'
set -xeuo pipefail
MAINVER=0.5
PREFIX=${PREFIX:-$HOME}
@kdm9
kdm9 / tara
Created June 8, 2016 05:29
tara
tara init af2573173e19a6ada1ab4a3486468336e05607e9
Wed Jun 8 15:26:44 2016 +1000
template<typename Data>
class concurrent_queue
{
private:
std::queue<Data> the_queue;
mutable std::mutex the_mutex;
std::condition_variable the_condition_variable;
public:
void push(Data const& data)
{
#!/bin/bash
if [ $# -lt 1 ]
then
echo "USAGE: run-debci-test <PKG.changes> [<outdir>]"
exit 1
fi
if [ $# -eq 2 ]
then
for pkg in $(cat allpkgs)
do
mkdir -p "${pkg}"
wget -nv -O "${pkg}/upstream_metadata" \
"http://anonscm.debian.org/cgit/debian-med/${pkg}.git/plain/debian/upstream/metadata" \
|| rm -f "${pkg}/upstream_metadata"
done
/*
* ============================================================================
*
* Filename: eigencalc.cc
* License: GPLv3+
* Author: Kevin Murray, spam@kdmurray.id.au
*
* ============================================================================
*/