Skip to content

Instantly share code, notes, and snippets.

@gabrik
gabrik / pre-commmit
Created Nov 5, 2021
pre-commit and pre-push hooks for Cargo
View pre-commmit
#!/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
View 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 Oct 16, 2020
prepare k3s node
View node-prepare.sh
#!/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 Sep 18, 2020
Machine monitoring to csv
View stat.pl
#!/usr/bin/perl
if ($#ARGV != 0 ) {
printf "usage: stat <container number>\n";
exit;
}
$cont=$ARGV[0];
open HOSTNAME, "hostname |";
View gist:988bc92f943425c2d3c4c3022d0a33b2
./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 Aug 5, 2019
containerd Go Client v1.2.7 Create container attached to existing Network Namespace
View container.go
package main
import (
"context"
"fmt"
"log"
"syscall"
"time"
// "bufio"
// "os"
@gabrik
gabrik / vm_template.xml
Last active Sep 26, 2018
vm xml template
View vm_template.xml
<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/>
@gabrik
gabrik / create_config.sh
Created Sep 26, 2018
Cloud Images Configurator
View create_config.sh
#!/bin/sh
# This will generate a openstack-style config drive image suitable for
# use with cloud-init. You may optionally pass in an ssh public key
# (using the -k/--ssh-key option) and a user-data blog (using the
# -u/--user-data option).
usage () {
echo "usage: ${0##*/}: [--ssh-key <pubkey>] [--vendor-data <file>] [--user-data <file>] [--uuid <uuid>] [--hostname
<hostname>] <imagename>"