Skip to content

Instantly share code, notes, and snippets.

View gabrik's full-sized avatar
🛰️
🦀

Gabriele Baldoni gabrik

🛰️
🦀
View GitHub Profile
@gabrik
gabrik / generate-ssh-key
Last active May 5, 2023 06:53 — forked from hongkongkiwi/generate-ssh-key
Simple one liner to generate an SSH key without a password in the default place with the comment as hostname then print out the public key for copy and paste.
HOSTNAME=`hostname` ssh-keygen -t ecdsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" && cat ~/.ssh/id_rsa.pub
@gabrik
gabrik / zigbee-ros2-teleop.py
Created February 22, 2023 16:29 — forked from JEnoch/zigbee-ros2-teleop.py
A Zenoh python script demonstrating ROS2 + Zigbee/MQTT integration
# This script is an example of ROS2 + Zigbee/MQTT integration thanks to Zenoh.
#
# By default, it assumes that:
# - a zenoh-bridge-dds is deployed and routes the ROS2 traffic to zenoh. It's configured to use "simu" as a scope.
# - a zenoh-bridge-mqtt is deployed and routes the MQTT traffic coming from zigbee2mqtt software
#
# This script can connect to any Zenoh endpoint using the "-e" option (a Zenoh router, the zenoh-bridge-dds or the zenoh-bridge-mqtt).
# Then it performs the following:
#
# - It subscribes in Zenoh to "zigbee2mqtt/device/button" to receive JSON messages from zigbee2mqtt when a Zigbee push button named "device/button" is pressed.
@gabrik
gabrik / gist:0adecd283d4dc426b497f524fff764c0
Last active August 26, 2022 12:28
ansible error in kvm
$ ansible-playbook -i vm-inventory.yml -e host=router small.yml -vvvv
ansible-playbook [core 2.13.3]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ato/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ato/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/ato/.ansible/collections:/usr/share/ansible/collections
executable location = /home/ato/.local/bin/ansible-playbook
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
@gabrik
gabrik / pre-commmit
Created November 5, 2021 16:41
pre-commit and pre-push hooks for Cargo
#!/bin/bash
diff=$(cargo fmt -- --check)
result=$?
if [[ ${result} -ne 0 ]] ; then
cat <<\EOF
There are some code style issues, run `cargo fmt` first.
EOF
exit 1
@gabrik
gabrik / teleoperation.json
Created November 3, 2020 16:12
teleoperation.json
{
"id": "example-entity-robotic",
"name": "example robotic entity",
"version": "0.2.1",
"entity_version": "0.0.1",
"description": "this is an example entity",
"fdus": [
{
"id": "tb3-motors",
"name": "turtlebot3_bringup",
@gabrik
gabrik / node-prepare.sh
Last active October 16, 2020 11:38
prepare k3s node
#!/bin/bash
sudo apt update && sudo apt upgrade -y
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common sshpass -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo usermod -aG docker $(whoami)
@gabrik
gabrik / stat.pl
Last active September 18, 2020 15:46
Machine monitoring to csv
#!/usr/bin/perl
if ($#ARGV != 0 ) {
printf "usage: stat <container number>\n";
exit;
}
$cont=$ARGV[0];
open HOSTNAME, "hostname |";
@gabrik
gabrik / gist:988bc92f943425c2d3c4c3022d0a33b2
Created April 10, 2020 06:07
opam 2.0.6 output on Android 9
./configure --prefix=/data/data/com.termux/files/usr/
checking for ocamlc... ocamlc
OCaml version is 4.09.0
OCaml library path is /data/data/com.termux/files/usr/lib/ocaml
checking for ocamlopt... ocamlopt
checking for ocamlc.opt... ocamlc.opt
checking for ocamlopt.opt... ocamlopt.opt
checking for ocaml... ocaml
checking for ocamldep... ocamldep
checking for ocamldep.opt... ocamldep.opt
@gabrik
gabrik / container.go
Created August 5, 2019 10:24
containerd Go Client v1.2.7 Create container attached to existing Network Namespace
package main
import (
"context"
"fmt"
"log"
"syscall"
"time"
// "bufio"
// "os"
@gabrik
gabrik / vm_template.xml
Last active September 26, 2018 17:04
vm xml template
<domain type="kvm">
<name><VM NAME></name>
<memory unit="MB">RAM</memory>
<vcpu placement="static">CPU</vcpu>
<os>
<type>hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>