Skip to content

Instantly share code, notes, and snippets.

Avatar

Dirk Thomas dirk-thomas

View GitHub Profile
@dirk-thomas
dirk-thomas / move_spam.py
Created Jan 11, 2016
Script to move spam pages to a different location
View move_spam.py
import os
import re
for name in os.listdir('.'):
if not re.search('quickbook', name, re.IGNORECASE):
continue
print(name)
os.rename(name, '../pages_deleted/' + name)
@dirk-thomas
dirk-thomas / test.bash
Created Oct 13, 2015
Bash array quoting
View test.bash
#!/usr/bin/env bash
mkdir "/tmp/test_bash"
mkdir "/tmp/test_bash/foo bar"
mkdir "/tmp/test_bash/bar baz"
mkdir "/tmp/test_bash/foo"
mkdir "/tmp/test_bash/bar"
touch "/tmp/test_bash/foo bar/file"
@dirk-thomas
dirk-thomas / ctest-repeat-until-fail.bash
Created Oct 8, 2015
ctest repeat-until-fail function for bashrc
View ctest-repeat-until-fail.bash
ctest-repeat-until-fail() {
count=0
ret=0
until [ ${ret} -ne 0 ]; do
count=$((count+1))
echo "Run #$count"
ctest $@
ret=$?
done
}
@dirk-thomas
dirk-thomas / example.html
Created Sep 21, 2015
Reveal.js based slides which fail to convert into pdf using decktape
View example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example slides</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
@dirk-thomas
dirk-thomas / CMakeLists.txt
Created Jul 7, 2015
CMakeLists.txt example with ament auto
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(foo)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif()
# find dependencies
@dirk-thomas
dirk-thomas / CMakeLists.txt
Created Jul 7, 2015
CMakeLists.txt example with ament
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(foo)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif()
# find dependencies
@dirk-thomas
dirk-thomas / CMakeLists.txt
Last active Aug 29, 2015
CMakeLists.txt example with catkin
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(foo)
# find dependencies
find_package(catkin REQUIRED COMPONENTS message_generation roscpp std_msgs)
find_package(Boost REQUIRED)
@dirk-thomas
dirk-thomas / gist:37febb42abeb8631f946
Last active Aug 29, 2015
Create "leaf" job with a single upstream dependency "before_leaf" where "before_leaf" has several (in this case 5: "a15" - "e15") upstream dependencies, each upstream dependency "xN" has "xN-1" as its upstream dependency.
View gist:37febb42abeb8631f946
job_prefix = 'jenkins21605_caseB_'
println 'Deleting jobs from previous tests...'
for (p in Jenkins.instance.allItems) {
if (!p.name.startsWith(job_prefix)) continue
println '- ' + p.name
p.delete()
}
println ''
@dirk-thomas
dirk-thomas / gist:9bbd47397e48ef3ceef8
Last active Aug 29, 2015
Create "leaf" job with a single upstream dependency "before_leaf" where "before_leaf" has many (in this case 40) upstream dependencies.
View gist:9bbd47397e48ef3ceef8
job_prefix = 'jenkins21605_caseA_'
println 'Deleting jobs from previous tests...'
for (p in Jenkins.instance.allItems) {
if (!p.name.startsWith(job_prefix)) continue
println '- ' + p.name
p.delete()
}
println ''
View gist:630084eefb44baa79f15
job_prefix = 'jenkins21605_'
println 'Deleting jobs from previous tests...'
for (p in Jenkins.instance.allItems) {
if (!p.name.startsWith(job_prefix)) continue
println '- ' + p.name
p.delete()
}
println ''