Instantly share code, notes, and snippets.

View tex-spell-check.md

interactive terminal :

aspell -t -c file.tex

list of misspelled words :

cat file.tex | aspell list -t | sort | uniq
View gif2png.md
convert -coalesce something.gif something.png

or

magick convert -coalesce something.gif something.png

the speed could be known using :

View vid2gif.md
ffmpeg -ss 61.0 -t 2.5 -i StickAround.mp4 -f gif StickAround.gif

-ss 61.0 seek to 61.0 seconds
-t 2.5 only read 2.5 then stop

ffmpeg -ss 61.0 -t 2.5 -i StickAround.mp4 -filter_complex "[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" SmallerStickAround.gif
View gzlog.md

playback in gui

gazebo -u -p ~/logs/double_pendulum/2016-01-25T15\:09\:49.677400/gzserver/state.log

from gazebo_ros

rosrun gazebo_ros gazebo --prefix '-u -p 2018-11-20T162127.065690/gzserver/state.log'
View roscpp-cheat.md

yaml

XmlRpc::XmlRpcValue my_list;
nh.getParam("my_list", my_list);
ROS_ASSERT(my_list.getType() == XmlRpc::XmlRpcValue::TypeArray);

for (int32_t i = 0; i < my_list.size(); ++i) 
{
  ROS_ASSERT(my_list[i].getType() == XmlRpc::XmlRpcValue::TypeDouble);
  sum += static_cast<double>(my_list[i]);
View angle-wrap.py
def norm_angle(dw) :
if math.fabs(dw) > math.pi :
return (-2*math.pi + dw) if dw > 0 else (2*math.pi + dw)
else : return dw
View cycheat.md

setup.py

from distutils.core import setup
from Cython.Build import cythonize

setup(
    ext_modules = cythonize("helloworld.pyx")
)

all *.pyx files in a folder

View rospy-cheat.md

get rospy.Time

now = rospy.Time.now()
now = rospy.get_rostime()
rospy.loginfo("Current time %i %i", now.secs, now.nsecs)

get time in seconds

now = rospy.get_time()
View rpy-quat.md
#include <tf2/LinearMath/Quaternion.h>
#include <tf/transform_datatypes.h>
...
tf2::Quaternion myQuaternion;
myQuaternion.setRPY( 0, 0, 0 );  // Create this quaternion from roll/pitch/yaw (in radians)
ROS_INFO_STREAM(q);  // Print the quaternion components (0,0,0,1)
...
quaternionMsgToTF(quat_msg , quat_tf);
View gdb-cheatsheet.md

add breakpoint

(gdb) break filename.ext:line

list breakpoint

(gdb) info break

disable breakpoint

(gdb) disable 1 disable breakpoint 1

backtrace function call

(gdb) bt

examining the stack