Skip to content

Instantly share code, notes, and snippets.

View alifahrri's full-sized avatar
🌊

Fahri Ali Rahman alifahrri

🌊
View GitHub Profile
@alifahrri
alifahrri / rospy-cheat.md
Last active November 20, 2018 18:00
cheatsheet for rospy

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()
@alifahrri
alifahrri / vid2gif.md
Last active November 29, 2018 11:06
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
alifahrri / gif2png.md
Last active December 4, 2018 15:57
gif to png files
convert -coalesce something.gif something.png

or

magick convert -coalesce something.gif something.png

the speed could be known using :

@alifahrri
alifahrri / tex-spell-check.md
Created December 6, 2018 15:43
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
alifahrri / vol-ctrl.py
Created December 12, 2018 15:58
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 vol-ctrl.py', 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
alifahrri / ssh.md
Created February 28, 2019 03:51
ssh stuff
# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
# add key
$ ssh-add
# list key
$ ssh-add -l
  • optional, if with initializer
https://stackoverflow.com/questions/39599242/in-c17-can-an-if-statement-with-an-initializer-be-used-to-unpack-an-optional
@alifahrri
alifahrri / docker-cheat.md
Last active September 28, 2019 04:23
docker cheatsheet

Docker Cheat Sheet

## List Docker CLI commands
docker
docker container --help

## Display Docker version and info
docker --version
docker version
docker info
@alifahrri
alifahrri / dockergui.md
Last active September 28, 2019 04:24
docker with gui
docker ...
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
namespace traits {

    template <typename T, typename = void>
    struct is_std_array : std::false_type {};
    template <typename T>
    struct is_std_array<T,std::enable_if_t<
        std::is_same_v<std::array<typename T::value_type, std::tuple_size<T>::value>, T>
    > > : std::true_type {};