Skip to content

Instantly share code, notes, and snippets.

View mbaldessari's full-sized avatar
🏠
Working from home

Michele Baldessari mbaldessari

🏠
Working from home
View GitHub Profile
@mbaldessari
mbaldessari / ethtool-speed-test.c
Created April 19, 2015 08:08
Get the speed of a network interface via the ethtool interface
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <net/if.h>
#include <ctype.h>
#define ETHTOOL_GSET 0x1
#define SIOCETHTOOL 0x8946
@mbaldessari
mbaldessari / argo.patch
Created August 24, 2023 10:59
Silly patch to allow to build argo with podman
diff --git a/Makefile b/Makefile
index 4c1191881..264ae6777 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,7 @@ DOCKER_SRC_MOUNT="$(DOCKER_SRCDIR):/go/src$(VOLUME_MOUNT)"
else
DOCKER_SRC_MOUNT="$(PWD):/go/src/github.com/argoproj/argo-cd$(VOLUME_MOUNT)"
endif
+DOCKER_RUN_OPTIONAL_ARGS?=
apiVersion: v1
kind: Pod
metadata:
name: bandini
namespace: imperative
spec:
serviceAccount: imperative-sa
containers:
- image: quay.io/hybridcloudpatterns/utility-container:latest
name: bandini
@mbaldessari
mbaldessari / docspr.py
Last active November 29, 2022 19:34
renders every pr
#!/usr/bin/python3
import os
import subprocess
import yaml
from github import Github
baseurl = "https://docs-pr.acksyn.org/pr"
@mbaldessari
mbaldessari / debug
Last active October 7, 2022 09:01
quick debug function
def lol(msg):
import datetime
with open('/tmp/lol.txt', 'a+', encoding='utf-8') as f:
f.write('[LOL] %s %s\n' % (str(datetime.datetime.now()), msg))
@mbaldessari
mbaldessari / sound-toggle.sh
Created July 16, 2022 10:17
Toggle pipewire/pulseaudio output or input on/off
#!/bin/bash
set -e
function error_out() {
echo "Error wrong arguments. Pick either input or output"
exit 1
}
if [ $# -ne 1 ]; then
error_out
@mbaldessari
mbaldessari / acm-import-cluster.yml
Created February 10, 2022 15:23
Playbook to import remote cluster in ACM
---
# We require the kubernetes collection. Install it first via:
# ansible-galaxy collection install community.kubernetes
#
# This expects four environment variables to be set:
# KUBECONFIG -> Pointing to the HUB
# REMOTEAPI -> API endpoint of the remote cluster
# REMOTECLUSTERNAME -> Name of the cluster you want to import
# REMOTETOKEN -> Token of the remote cluster
- name: Playbook to import a cluster
@mbaldessari
mbaldessari / ovn-commands.txt
Last active August 26, 2021 16:50
ovn commands
export SBDB=$(sudo ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g') ; export NBDB=$(sudo ovs-vsctl get open . external_ids:ovn-remote
| sed -e 's/\"//g' | sed -e 's/6642/6641/g') ; alias ovn-sbctl='sudo podman exec ovn_controller ovn-sbctl --db=$SBDB' ; alias ovn-nbctl='sudo podman
exec ovn_controller ovn-nbctl --db=$NBDB' ; alias ovn-trace='sudo podman exec ovn_controller ovn-trace --db=$SBDB'
ovn-sbctl list chassis
ovs-vsctl get open . external_ids:ovn-bridge-mappings
ovn-nbctl --db="ssl:172.17.1.122:6641" -p /etc/pki/tls/private/ovn_controller.key -c /etc/pki/tls/certs/ovn_controller.crt -C /etc/ipa/ca.crt show
#!/bin/bash
set -x
source /etc/os-release
sudo systemctl stop tripleo_\*
sudo systemctl stop ceph\*
sudo pcs cluster destroy
if [ $VERSION_ID == "7" ]; then
sudo docker ps -a -q | xargs docker rm -f
else
ospgrep() {
echo "$*"
grep -E "\s\b(E[rR]{2}:?|alert|Traceback|TRACE|crit|fatal|HANDLER|TASK|PLAY|Unexpected|FAIL|[Ff]ail|denied|non-zero|[Tt]ime[d\s]?out|UNCAUGHT|EXCEPTION|Unknown|[Aa]ssertion|inuse)" $*
}