Skip to content

Instantly share code, notes, and snippets.


Fahri Ali Rahman alifahrri

View GitHub Profile
alifahrri /
Last active Mar 6, 2019
docker cheatsheet

Docker Cheat Sheet

## List Docker CLI commands
docker container --help

## Display Docker version and info
docker --version
docker version
docker info
alifahrri /
Created Dec 12, 2018
control ubuntu audio volume from python
from subprocess import call
from time import sleep
from datetime import datetime
import argparse
if __name__ == '__main__' :
parser = argparse.ArgumentParser(progname='python', description='decrease volume with delay')
parser.add_argument('-i','--init',type=int,help='initial volume')
parser.add_argument('-r','--rate',type=int,help='decrease rate')
parser.add_argument('-d','--delay',type=int,help='decrease delay in seconds')
alifahrri /
Created Dec 6, 2018
latex spell check from command line

interactive terminal :

aspell -t -c file.tex

list of misspelled words :

cat file.tex | aspell list -t | sort | uniq
alifahrri /
Last active Dec 4, 2018
gif to png files
convert -coalesce something.gif something.png


magick convert -coalesce something.gif something.png

the speed could be known using :

alifahrri /
Last active Nov 29, 2018
video to gif with ffmpeg
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
alifahrri /
Last active Nov 20, 2018
gazebo data logger

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'
alifahrri /
Created Nov 11, 2018
cheatsheet for roscpp


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]);
alifahrri /
Last active Oct 31, 2018
py code for wrapping around an angle
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
alifahrri /
Last active Oct 28, 2018
cheatsheet for cython

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

    ext_modules = cythonize("helloworld.pyx")

all *.pyx files in a folder

alifahrri /
Last active Nov 20, 2018
cheatsheet for rospy

get 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()
You can’t perform that action at this time.