Skip to content

Instantly share code, notes, and snippets.

@khssnv
khssnv / Vagrantfile
Created Dec 4, 2020
Ubuntu Server 20.04 Focal with Desktop packages and development tools
View Vagrantfile
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Ubuntu Server with GNOME3 desktop and development tools
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.box_check_update = false
config.vm.hostname = "ufvm2"
View out.md
% ros2 launch run_moveit_cpp run_moveit_cpp.launch.py
[INFO] [launch]: All log files can be found below /home/khassanov/.ros/log/2020-09-15-11-24-34-337151-vm20-3394
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [static_transform_publisher-1]: process started with pid [3401]
[INFO] [robot_state_publisher-2]: process started with pid [3403]
[INFO] [rviz2-3]: process started with pid [3410]
[INFO] [run_moveit_cpp-4]: process started with pid [3412]
[INFO] [fake_joint_driver_node-5]: process started with pid [3419]
[static_transform_publisher-1] [INFO] [1600161874.685619758] [static_transform_publisher]: Spinning until killed publishing transform from 'world' to 'panda_link0'
View gist:dfbbc809c7dbcbeaeefaaa4225a9f8ba

If you have a problem with ros_comm built with python3 on Ubuntu 18.04 like

$ rostopic list
Traceback (most recent call last):
  File "/home/user/Workspace/catkin_ws/devel/bin/rostopic", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/user/Workspace/catkin_ws/src/ros_comm/tools/rostopic/scripts/rostopic", line 35, in <module>
    rostopic.rostopicmain()
  File "<string>", line 2118, in rostopicmain
  File "/home/user/Workspace/catkin_ws/devel/lib/python3/dist-packages/rosbag/__init__.py", line 34, in <module>
View ROS_oneliners.md

1. Copy a segment from rosbag file

rosbag filter in.bag out.bag "t.to_sec() >= 1582908021.4 and t.to_sec() <= 1582908029.0"

Source: How to split a recorded rosbag file?

2. Graceful stop for rosbag recording

rosbag record -O out.bag cmd_vel __name:=rosbag
rosnode kill /rosbag
@khssnv
khssnv / tmux_cheatsheet.md
Last active Feb 13, 2020
Tmux cheatsheet for Autonomous Kitchen
View tmux_cheatsheet.md
  1. Add connection config to ssh (it's only for NUC only, you may find jetsons configs in chat):

Open ~/.ssh/config.

Add this and save:

Host nuc-1
    Hostname 192.168.7.231
    User remy
    ForwardX11 yes
@khssnv
khssnv / ROS2_oneliners.md
Created Oct 3, 2019
Handy ROS2 shell commands
View ROS2_oneliners.md

Build one package with symlinks instead of executables

(to use changed python scripts without rebuilding)

colcon build --packages-select <package_name> --symlink-install

Launch a test with verbose output

colcon test --packages-select <package_name> --pytest-args -k <test_function_name> --event-handlers console_direct+
@khssnv
khssnv / AIRA_oneliners.md
Last active Jun 13, 2019
Handy AIRA oneliners
View AIRA_oneliners.md

Start your own Liability contract

Replace fields with your values

rostopic pub /liability/incoming robonomics_liability/Liability '{address: {address: "0x5e2024cc4c286f28037C0A3B7b9487Da51fcb2B8"}, model: {multihash: "QmYb81uDNDHCnu9EZtYV4eoBDKRBAwJeNy1LT3p5Zbc357"}, objective: {multihash: "Qmea8XkcSXmvLDKES7D886pfimsWh9Vjh1ZJsoHm9MWG4C"}, result: {multihash: ""}, promisee: {address: "0xB819d9BC2E665962BCa62Cd859059875BABB134c"}, promisor: {address: "0xB85DD5F194a18657f24792a793306b218637ce40"}, lighthouse: {address: "0xD40AC7F1e5401e03D00F5aeC1779D8e5Af4CF9f1"}, token: {address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}, cost: {uint256: "100000000000000000"}, validator: {address: "0x0000000000000000000000000000000000000000"}, validatorFee: {uint256: "0"}}'

Periodically reconnect to airalab IPFS star node

watch -n 10 ipfs --api=/ip4/127.0.0.1/tcp/5001 swarm connect /dns4/lighthouse.aira.life/tcp/4001/ipfs/QmdfQmbmXt6sqjZyowxPUsmvBsgSGQjm4VXrV7WGy62dv8
@khssnv
khssnv / robonomics_comm-nightly.md
Last active May 22, 2019
Use robonomics_comm nightly
View robonomics_comm-nightly.md
  1. Download airapkgs
cd ~
git clone https://github.com/airalab/airapkgs.git airapkgs

or faster

cd ~
wget https://github.com/airalab/airapkgs/archive/nixos-unstable.zip
nix-shell -p unzip --run "unzip -d ~/airapkgs ~/nixos-unstable.zip"
@khssnv
khssnv / configuration.nix
Created Feb 4, 2019
NixOS configuration for AIRA on Airalab Sidechain
View configuration.nix
{ config, pkgs, lib, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix> <nixpkgs/nixos/modules/installer/aira.nix> <nixpkgs/nixos/modules/profiles/aira-sidechain.nix> ];
swapDevices =
[ { device = "/swap"; } ];
zramSwap.enable = true;
service.openssh.enable = true;
users.extraUsers.root.openssh.authorizedKeys.keys = [
"YourPublicKeyHere"
@khssnv
khssnv / shell_oneliners.md
Last active Dec 8, 2020
Usefull shell commands what fits one line
View shell_oneliners.md

Color golang test output

go test -v ./tests | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/''

Backup your user home data excluding some files

cd ~
tar -cvpzf backup.tar.gz --exclude=./backup.tar.gz --exclude=./.local/share/io.parity.ethereum/chains/ --one-file-system .