Skip to content

Instantly share code, notes, and snippets.

View MikeDacre's full-sized avatar

Mike Dacre MikeDacre

View GitHub Profile
@MikeDacre
MikeDacre / run_rename.py
Created September 13, 2016 23:25
Run simple script with python-cluster
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Submit a bunch of jobs."""
import sys
import argparse
from time import sleep
import cluster
CMD = '/home/dacre/mike_tools/bin/rename_mesh_snps.py {bed} -i {infile} -o {outfile}'
@MikeDacre
MikeDacre / .python-cluster
Created September 7, 2016 22:06
Cluster profile file for fraser cluster
[opts]
[queue]
max_jobs = 1000
sleep_len = 2
queue_update = 5
[prof_default]
cores = 1
mem = 4000
@MikeDacre
MikeDacre / .python-cluster
Created September 7, 2016 22:04
Python Cluster profile for sherlock cluster
[opts]
queue = hbfraser
[queue]
max_jobs = 1000
sleep_len = 2
queue_update = 5
[prof_default]
cores = 1
@MikeDacre
MikeDacre / private-content.patch
Created April 29, 2016 23:13
Private Content Spelling Patch
diff -Naur private-content.orig/functions.php private-content/functions.php
--- private-content.orig/functions.php 2016-04-29 15:42:09.587388342 -0700
+++ private-content/functions.php 2016-04-29 15:57:32.032192704 -0700
@@ -266,8 +266,8 @@
if($bulk_opts) {
$opts['pc_cats']['opts'] = array(
- 'all' => __('Any logged user', 'pc_ml'),
- 'unlogged' => __('Unlogged Users', 'pc_ml'),
+ 'all' => __('Any logged in user', 'pc_ml'),
@MikeDacre
MikeDacre / private-content-secure-links.patch
Created April 27, 2016 22:59
Fix spelling mistake in Private Content Secure Links
@MikeDacre
MikeDacre / public_api.patch
Created April 27, 2016 22:50
Patch for Private Content mail function to make wp_mail() default when it is supposed to be.
--- public_api.php.orig 2016-04-27 15:45:37.237260404 -0700
+++ public_api.php 2016-04-27 15:44:53.737239447 -0700
@@ -37,7 +37,7 @@
// switch between PHPmailer and basic PHP mail() function
- if(get_option('pcma_use_basic_func')) {
+ if(! get_option('pcma_use_basic_func')) {
$headers = "From: ".$from_name." <".strip_tags($from_mail).">\r\n";
@MikeDacre
MikeDacre / README.md
Created April 26, 2016 05:21
Make SearchWP work with Members

To use this code, pop index.php and searchwp-members.php into a directory named searchwp-members, zip it up with zip -r searchwp-members.zip searchwp-members, and install the zip file in wordpress.

It works with ajax live search also.

@MikeDacre
MikeDacre / job_runner.py
Created April 15, 2016 21:54
Python background job runner
def job_runner(jobqueue, outputs, cores=1, jobno=1):
"""
jobs: [(command, args)]
outputs: {id: retval}
"""
import sys
def output(out):
"""Let's try and explicitly clear the dictionary before sending the output."""
lastout = outputs.get() if not outputs.empty() else ''
if out == lastout:
@MikeDacre
MikeDacre / test.sbatch
Created February 26, 2016 20:12
SLURM DMTCP Test
#!/bin/bash
#SBATCH --partition=hbfraser
#SBATCH --time=00:02:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --signal=36@30
#----------------------------- Set up DMTCP environment for a job ------------#
###############################################################################
#!/bin/bash
#SBATCH --partition=<partition>
#SBATCH --time=00:02:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --signal=b:USR1@10
trap_with_arg() {
func="$1" ; shift