Skip to content

Instantly share code, notes, and snippets.

@stuartcampbell
stuartcampbell / redhat_boost_case1178175.cxx
Created February 25, 2015 02:41
Demo of boost issue for support case 1178175
#include <algorithm>
#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>
int main() {
// Define (and initialise) a string vector
std::vector<std::size_t> intVector;
@stuartcampbell
stuartcampbell / qwt3d_openglhelper.diff
Created February 25, 2015 03:16
Patch file for qwt3d_openglhelper.h
--- include/qwt3d_openglhelper.h 2005-07-19 11:40:28.000000000 -0400
+++ include/qwt3d_openglhelper.h.new 2014-03-18 15:22:02.000000000 -0400
@@ -1,6 +1,8 @@
#ifndef __openglhelper_2003_06_06_15_49__
#define __openglhelper_2003_06_06_15_49__
+#include <GL/glu.h>
+
#include "qglobal.h"
#if QT_VERSION < 0x040000
@stuartcampbell
stuartcampbell / detector-pars.csv
Created May 4, 2015 19:07
Detector Parameter file for testing VisionLoadDetectorTable algorithm
1334 16.00 3.6164963731 45.00 0.7673807215 2
1335 16.00 3.6063960269 45.00 0.766102657 2
1336 16.00 3.5962882317 45.00 0.7648411252 2
1337 16.00 3.5861803695 45.00 0.7635962239 2
1338 16.00 3.5760798221 45.00 0.7623680508 2
1339 16.00 3.5659939715 45.00 0.7611567035 2
1340 16.00 3.5559301996 45.00 0.7599622797 2
1341 16.00 3.5458958885 45.00 0.7587848771 2
1342 16.00 3.5358984199 45.00 0.7576245935 2
1343 16.00 3.5259451759 45.00 0.7564815266 2
@stuartcampbell
stuartcampbell / gist:52724ec474bc6af2d345
Created May 13, 2015 19:19
Trac URL to get my tickets
http://trac.mantidproject.org/mantid/query?owner=Stuart+Campbell&status=assigned&status=inprogress&status=new&status=reopened&status=verify&status=verifying&col=id&col=summary&col=description&col=priority&col=component&col=keywords&order=priority
@stuartcampbell
stuartcampbell / gist:e1c508e93d13814a6c93
Created May 18, 2015 18:52
Issue Migration Planning

Auth as reporter if no key - authenticate as mantid-builder, then append either @ or "First Lastname" from trac

Use correct datetime

Append link to trac at end of description Append trac keywords .....

construct list of labels

@stuartcampbell
stuartcampbell / iterate_n_lines.py
Created June 1, 2015 15:36
Iterating over 3 lines at a time (for stdout) in Python
import subprocess
import itertools
# execute some command
since = "--since='{0}-{1}-1'".format(str(year), str(month))
until = "--before='{0}-{1}-{2}'".format(str(year), str(month), str(days_in_month[month-1]))
args = ['git', 'log', '--pretty=format:"%ai %aE"', '--shortstat', since, until]
sub = subprocess.Popen(args, stdout=subprocess.PIPE, close_fds=True, cwd='/path/to/git/repo/clone')
for line1,line2,line3 in itertools.izip_longest(*[sub.stdout]*3):
@stuartcampbell
stuartcampbell / get_milestones_from_github.py
Created June 3, 2015 15:59
Get a list of milestones from github and deal with paging
def get_milestones_from_github():
print('Getting list of all milestones from Github.')
req = requests.get('https://api.github.com/repos/mantidproject/mantid/milestones',
params={'state': 'all'})
# print(r)
_milestones = {}
for milestone in req.json():
# print(milestone)
_milestones[milestone['title']] = milestone['number']
@stuartcampbell
stuartcampbell / jenkins-clean-slave-workspaces.groovy
Created October 6, 2015 16:20
A jenkins script to clean up workspaces on slaves which have < 10GB of free space
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
@stuartcampbell
stuartcampbell / print_diamond_peaks.py
Last active November 16, 2015 21:28
Print Diamond Peaks
# d-values for diamond
diamond = PoldiCreatePeaksFromCell(SpaceGroup='F d -3 m', Atoms='C 0 0 0', a=3.567925, LatticeSpacingMin=0.4, OutputWorkspace='diamond')
diamond = [float(item['d']) for item in diamond] # extract the d-values
diamond.extend((.4093,.4327,.5379,.5947)) # add in peaks from Ashfia
diamond = list(set(diamond)) # remove duplicates
#diamond=[item for item in diamond if item > binning[0] and item < binning[-1]]
diamond.sort()
print diamond
@stuartcampbell
stuartcampbell / arch_list_pkgs_using_stdlib.sh
Created December 10, 2015 21:13
List Arch packages to rebuild
#!/bin/bash
while read pkg; do
mapfile -t files < <(pacman -Qlq $pkg | grep -v /$)
grep -Fq libstdc++.so.6 "${files[@]}" <&- 2>/dev/null && echo $pkg
done < <(pacman -Qmq)