Skip to content

Instantly share code, notes, and snippets.

@allenday
allenday / file_timewarp.pl
Created May 18, 2017 04:44
multiply the stat ctime value of a directory of files
#!/usr/bin/perl
use strict;
use Time::HiRes;
my $rat = shift @ARGV;
my $dir = shift @ARGV;
$rat ||= 1;
-d $dir or die "$0 <ratio> <dir>";
my @files = `find $dir -type f`;
<?php
/**
* Plugin Name: Elegant Tweaks Portfolio Posts
* Plugin URI: http://shop.eleganttweaks.com/divi/posts-plugin/
* Description: Divi posts display same as project posts
* Version: 1.02
* Author: Brad Crawford
* Author URI: http://www.eleganttweaks.com
**/
@allenday
allenday / nvidia-smi.output.txt
Created June 7, 2017 01:19
output of `nvidia-smi`
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.66 Driver Version: 375.66 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 0000:00:04.0 Off | 0 |
| N/A 33C P8 29W / 149W | 0MiB / 11439MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
@allenday
allenday / nvidia-docker-plugin.output.txt
Created June 7, 2017 01:21
output of `nvidia-docker-plugin`
nvidia-docker-plugin | 2017/06/07 01:05:05 Loading NVIDIA unified memory
nvidia-docker-plugin | 2017/06/07 01:05:05 Loading NVIDIA management library
nvidia-docker-plugin | 2017/06/07 01:05:08 Discovering GPU devices
nvidia-docker-plugin | 2017/06/07 01:05:08 Provisioning volumes at /var/lib/nvidia-docker/volumes
nvidia-docker-plugin | 2017/06/07 01:05:08 Serving plugin API at /run/docker/plugins
nvidia-docker-plugin | 2017/06/07 01:05:08 Serving remote API at localhost:3476
@allenday
allenday / install-cuda.sh
Created June 7, 2017 02:59
Install CUDA debian package
#!/bin/bash
echo "Checking for CUDA and installing."
# Check for CUDA and try to install.
if ! dpkg-query -W cuda; then
# The 16.04 installer works with 16.10.
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda -y
fi
@allenday
allenday / install-docker-ce.sh
Last active June 14, 2017 03:07
install Docker version (instead of Ubuntu version) of docker (docker-ce and not docker.io)
#/bin/bash
# install packages to allow apt to use a repository over HTTPS:
sudo apt-get -y install \
apt-transport-https ca-certificates curl software-properties-common
# add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# set up the Docker stable repository.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
@allenday
allenday / make_TsvHttpData.pl
Last active September 3, 2018 10:07
Create URL list for Google Cloud Storage Transfer Service, see: https://cloud.google.com/storage/transfer/create-url-list
#!/usr/bin/perl
use strict;
my $http_base = shift;
my $path_base = shift;
my $prev_file = shift;
if ( ! $http_base || ! $path_base ) {
print STDERR <<"HERE";
USAGE:
@allenday
allenday / load_jquery_chrome_console.js
Created July 8, 2017 08:17
Load jQuery to Chrome console
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
@allenday
allenday / startup-script-bwa-http-docker
Last active July 14, 2017 15:21
Startup script for running bwa-http-docker container as a Google Compute Engine Instance Template.
#Startup script for running bwa-http-docker container as a Google Compute Engine Instance Template.
DOCKER_IMAGE=`wget --header 'Metadata-Flavor: Google' -O - -q 'http://metadata.google.internal/computeMetadata/v1/instance/attributes/DOCKER_IMAGE'`
BWA_FILES=`wget --header 'Metadata-Flavor: Google' -O - -q 'http://metadata.google.internal/computeMetadata/v1/instance/attributes/BWA_FILES'`
apt-get update && apt-get -y install docker.io
gcloud docker -- pull $DOCKER_IMAGE
docker run -P -e BWA_FILES=$BWA_FILES $DOCKER_IMAGE
@allenday
allenday / bwa-http-docker-dialog.sh
Last active July 14, 2017 15:51
bwa-http-docker service usage and output
# create a fastq file
user@host:/home/user# echo "@id
AGCTTTTCTATAAAATTTAACTTACATTTTTGATATCTAATAATTGATCTACTCAAGTTA
+
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" > /tmp/my.fq
# POST that file to the webserver
user@host:/home/user# curl --form database=human.fasta --form fastq=@/tmp/my.fq http://10.142.0.2/cgi-bin/bwa.cgi
# response will look something like this
# [...]
@PG ID:bwa PN:bwa VN:0.7.10-r789 CL:bwa mem /data/human.fasta /tmp/Nc22LIRneb.fq