From this stack overflow thread.
top -c -p $(pgrep -d',' -f NAME)| #!/usr/bin/env python | |
| import sys | |
| import numpy as np | |
| import cv2 | |
| import rospy | |
| from cv_bridge import CvBridge, CvBridgeError | |
| from sensor_msgs.msg import CameraInfo, Image, CompressedImage | |
| """ | |
| Publish a default CameraInfo topic from an Image or CompressedImage topic |
| #!/usr/bin/env python3 | |
| import sys | |
| import argparse | |
| import os | |
| import subprocess | |
| import signal | |
| import time | |
| import threading | |
| import shlex | |
| import docker |
From this stack overflow thread.
top -c -p $(pgrep -d',' -f NAME)In order to open a Visual Studio Code sometimes we want to do it from the command line. Either because that allows us to just open the current file or folder, or because we would like to script opening some specific resource. This resource may be placed in another machine (e.g. via ssh), or in a docker container (running in the same machine or in another machine).
code <file or folder>
# e.g. code .| #/usr/bin/env python | |
| import socket | |
| import time | |
| from multiprocessing import Process, Queue | |
| def check_server(address, queue, port=11311): | |
| # Create a TCP socket | |
| s = socket.socket() | |
| try: | |
| s.connect((address, port)) |
| # this is part of .bashrc / .bash_profile | |
| if [[ $(ps aux | grep bin/roscore | grep -v grep) ]]; then | |
| export ROS_MASTER_URI=`python -c "import rosgraph; print(rosgraph.Master('ip_checker').getUri())"` | |
| export ROS_IP=`python -c "import rosgraph; print(rosgraph.Master('ip_checker').getUri().replace('http://','').replace(':11311/',''))"` | |
| export ROS_NETWORK_INTERFACE=`ifconfig | grep $ROS_IP -1 | awk 'NR==1{print $1}' | sed 's/://g'` | |
| else | |
| echo "No roscore found, setting ROS_MASTER_URI and ROS_IP to localhost defaults." | |
| export ROS_MASTER_URI=http://localhost:11311 | |
| export ROS_IP=127.0.0.1 | |
| export ROS_NETWORK_INTERFACE=lo |
ffmpeg -i video.mp4 -r 15 -vf "scale=512:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -ss 00:00:03 -to 00:00:09 video.gifFrom https://askubuntu.com/questions/648603/how-to-create-an-animated-gif-from-mp4-video-via-command-line
-i video.mp4 is the input video.-r 15 is the FPS, 10 or 15 is usually fine, more would be too big of a file.-vf "scale=512:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse optimizes the palette of colors of the gif and sets the scale (512px here, use 768 if you need it a bit bigger, but be aware of the final size of the gif if you do so, 512 is a good tradeoff).| #!/bin/bash | |
| tar cvzf cmake-3.18.0.binary-aarch64.tar.gz /usr/local/doc/cmake-3.18/cmsys/Copyright.txt /usr/local/doc/cmake-3.18/cmlibrhash/COPYING /usr/local/doc/cmake-3.18/cmzlib/Copyright.txt /usr/local/doc/cmake-3.18/cmcurl/COPYING /usr/local/doc/cmake-3.18/cmnghttp2/COPYING /usr/local/doc/cmake-3.18/cmzstd/LICENSE /usr/local/doc/cmake-3.18/cmliblzma/COPYING /usr/local/doc/cmake-3.18/cmlibarchive/COPYING /usr/local/doc/cmake-3.18/cmlibuv/LICENSE /usr/local/bin/cmake /usr/local/bin/ctest /usr/local/bin/cpack /usr/local/share/cmake-3.18/include/cmCPluginAPI.h /usr/local/doc/cmake-3.18/Copyright.txt /usr/local/share/cmake-3.18/Help /usr/local/share/cmake-3.18/Help/prop_cache /usr/local/share/cmake-3.18/Help/prop_cache/ADVANCED.rst /usr/local/share/cmake-3.18/Help/prop_cache/VALUE.rst /usr/local/share/cmake-3.18/Help/prop_cache/HELPSTRING.rst /usr/local/share/cmake-3.18/Help/prop_cache/STRINGS.rst /usr/local/share/cmake-3.18/Help/prop_cache/MODIFIED.rst /usr/local/share/cmake-3.18/Help/prop_cache/TYPE.rst /usr |