Skip to content

Instantly share code, notes, and snippets.

@dirk-thomas
dirk-thomas / CMakeLists.txt
Last active March 7, 2023 06:03
CMakeLists.txt example with catkin
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 / CMakeLists.txt
Created July 7, 2015 20:05
CMakeLists.txt example with ament
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 July 7, 2015 20:09
CMakeLists.txt example with ament auto
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 / example.html
Created September 21, 2015 21:45
Reveal.js based slides which fail to convert into pdf using decktape
<!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 / ctest-repeat-until-fail.bash
Created October 8, 2015 20:55
ctest repeat-until-fail function for bashrc
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 / test.bash
Created October 13, 2015 18:05
Bash array quoting
#!/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 / move_spam.py
Created January 11, 2016 17:38
Script to move spam pages to a different location
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 / find_pages_with_content.py
Created January 11, 2016 17:39
Find pages which didn't contain spam before
import os
import re
for name in os.listdir('.'):
if not os.path.exists(name + '/revisions/00000002'):
continue
with open(name + '/revisions/00000001', 'r') as h:
content = h.read()
if re.search('quickbook', content, re.IGNORECASE):
continue
@dirk-thomas
dirk-thomas / main.cpp
Created April 14, 2016 23:39
QMenu bug when removing last action
#include <cstdio>
#include <QtCore/qobject.h>
#include <QtWidgets/qaction.h>
#include <QtWidgets/qapplication.h>
#include <QtWidgets/qmainwindow.h>
#include <QtWidgets/qmenubar.h>
QMenu * more_menu = 0;
@dirk-thomas
dirk-thomas / CMakeLists.txt
Last active May 6, 2016 18:16
Visual Studio dependencies issue
cmake_minimum_required(VERSION 3.4)
project(foo)
add_custom_target(
gen
SOURCES "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp"
COMMENT "Custom target"
)