Skip to content

Instantly share code, notes, and snippets.

View rpapallas's full-sized avatar

Rafael Papallas rpapallas

View GitHub Profile
@rpapallas
rpapallas / pdf_compressor.scpt
Created June 30, 2019 17:37
A simple AppleScript to automatically (lossless) compress a PDF using PDFExpert Compress Feature.
# Copyright (C) 2019 Rafael Papallas
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@rpapallas
rpapallas / .bashrc
Created April 16, 2019 11:20
Get local weather forecast from within your terminal
weather() {
curl wttr.in
}
@rpapallas
rpapallas / apply_rotations_to_quat.py
Last active November 19, 2018 12:38
Apply rotations to quaternions quick utility tool using Python
# Requires pyquaternion -- pip install --user pyquaternion
from pyquaternion import Quaternion
import math
def apply_rotation(q1, axis, angle):
q2 = Quaternion(axis=axis, angle=angle)
result = q1 * q2
return result.elements
q1 = Quaternion(1, 0, 0, 0)
@rpapallas
rpapallas / opencv3_ros_indigo.sh
Last active September 20, 2018 13:19
Use with care. An up-to-date shell script for installing OpenCV 3 with ROS Indigo based on https://github.com/taochenshh/OpenCV-3.1-with-Python-2.7-and-ROS-Indigo. Note that this script is not fully tested but once we test this on a new machine we will update it.
# Copyright (C) 2018 The University of Leeds, School of Computing
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@rpapallas
rpapallas / trajectory_with_deltatime.cpp
Created September 10, 2018 13:02
OMPL to OpenRAVE Trajectory with custom delta times.
// Input:
// path: ompl::control::PathControl
// penv: OpenRAVE::EnvironmentBasePtr
// robot: OpenRAVE::RobotBasePtr
//
// Output: Will create an OpenRAVE trajectory from the OMPL PathControl and will also parse deltatimes.
TrajectoryBasePtr or_traj = RaveCreateTrajectory(penv, "");
auto configuration_specification = robot->GetActiveConfigurationSpecification();
configuration_specification.AddDeltaTimeGroup();
@rpapallas
rpapallas / save_env_to_file.py
Last active April 24, 2018 09:52
Export OpenRAVE Environment to XML File
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@rpapallas
rpapallas / rotation _matrices.txt
Created March 22, 2018 16:16
Rotation matrices by an angle θ about X, Y, Z axis
Rz(θ) =
[ cos θ -sin θ 0 ]
[ sin θ cos θ 0 ]
[ 0 0 1 ]
Ry(θ) =
[ cos θ 0 sin θ ]
[ 0 1 0 ]
[ -sin θ 0 cos θ ]
@rpapallas
rpapallas / force_attribute_definition.py
Last active March 18, 2018 19:48
This will force the definition of a class attribute and will throw an error if not defined in Python.
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@rpapallas
rpapallas / get_translation_and_rotation_xml.py
Last active March 5, 2018 13:50
OpenRAVE: Given a transform 2D list of an object it will return back the translation and rotation as separated XML elements to be used in an environment.xml file.
def get_xml(arr):
rotation = "<RotationMat>"
for row in range(0, 3):
for col in range(0, 3):
rotation += str(arr[row, col])
if row != 2 or col != 2: rotation += " "
rotation += "</RotationMat>"
translation = "<Translation>"
for row in range(0, 3):
@rpapallas
rpapallas / cite.tex
Last active October 27, 2017 14:20
Cite numeric with author
\usepackage[numbers]{natbib}
\usepackage{cleveref}
\usepackage{hyperref}
\begin{document}
Some cite \cite{somepaper} and then with author et al \citet{somepaper}.
\bibliographystyle{unsrtnat}
\bibliography{refs}
\end{document}