Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# This script installs fail2ban and configures a default fail2ban ssh jail that uses ufw firewall rules
# Note this script needs to be run with sudo
# Brian Jensen <jensen@cs.tum.edu>
apt-get install -y fail2ban && cat >/etc/fail2ban/jail.local <<EOL
[DEFAULT]
# "bantime" is the number of seconds that a host is banned.
bantime = 1800
@jensenb
jensenb / README.md
Last active August 29, 2015 14:09
Transparently split python package (for binary extensions)

Summary

This is a demo of how a python package can be transparently split between two locations. This setup is particularly useful when your package contains binary extension modules that are built out of the source tree, i.e. with cmake, but your package also contains pure python source files. With the setup described below all modules will appear as a single unified package, while retaining their separate file locations. All that is required is that root/build/ is on the python path and that root/build/mypkg/__init__.py has information about the absolute location of root/src. With this strategy any errorprone file copying is avoided.

Directory Structure

root/
    build/
 test.py
import cv2
import numpy as np
def in_front_of_both_cameras(first_points, second_points, rot, trans):
# check if the point correspondences are in front of both images
rot_inv = rot
for first, second in zip(first_points, second_points):
first_z = np.dot(rot[0, :] - second[0]*rot[2, :], trans) / np.dot(rot[0, :] - second[0]*rot[2, :], second)
first_3d_point = np.array([first[0] * first_z, second[0] * first_z, first_z])
@jensenb
jensenb / build.log
Created November 7, 2013 10:06
Qt 4.8.5 build problem with libc++ on OS X Mavericks. By slightly patching the Qt 4.8 build system, it is possible to get it to use libc++ instead of libstdc++ on Mavericks. But the third party component JavaScriptCore appears to be incompatible with libc++.
/private/tmp/qt-Lsy7/bin/qmake -spec mkspecs/unsupported/macx-clang -o Makefile projects.pro
cd src/tools/bootstrap/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
/private/tmp/qt-Lsy7/bin/qmake -spec ../../../mkspecs/unsupported/macx-clang -o Makefile bootstrap.pro
make[1]: Nothing to be done for `first'.
cd src/tools/moc/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
/private/tmp/qt-Lsy7/bin/qmake -spec ../../../mkspecs/unsupported/macx-clang -o Makefile moc.pro
make[1]: Nothing to be done for `first'.
cd src/tools/rcc/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
/private/tmp/qt-Lsy7/bin/qmake -spec ../../../mkspecs/unsupported/macx-clang -o Makefile rcc.pro
make[1]: Nothing to be done for `first'.
@jensenb
jensenb / publish_images.py
Created November 4, 2013 14:35
ROS Python code for publishing synchronized stereo image pairs together with camera information. The script expects that the images are properly prefixed and sequenced, i.e. Left_01.png, Left_02.png, and that image files with the same sequence number correspond to one another. Most of the parameters can be set over the command line, including th…
#!/usr/bin/env python
# simple script to push a series of stereo images in a loop
from docutils.nodes import paragraph
import cv2
import numpy as np
import rospy
from sensor_msgs.msg import CameraInfo, Image
import time
import yaml