Skip to content

Instantly share code, notes, and snippets.

@CoRfr
CoRfr / awsEksNodePricing.py
Created May 19, 2021 19:54
Script to collect AWS EC2 instance prices and associated EKS pod limit
#!/usr/bin/env python3
import logging
from os import cpu_count
import boto3
import json
import requests
from pkg_resources import resource_filename
from multiprocessing import Pool
import tabulate
@CoRfr
CoRfr / buildFarm.groovy
Created November 22, 2020 04:02
Jenkins pipeline build() function that uses results from build-failure-analyzer plugin to automatically retrigger builds
import hudson.AbortException
import com.sonyericsson.jenkins.plugins.bfa.model.FailureCauseBuildAction
import org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterValue
import org.jvnet.jenkins.plugins.nodelabelparameter.node.AllNodeEligibility
import hudson.model.Label
import hudson.model.labels.LabelExpression
import jenkins.model.Jenkins
import com.cloudbees.groovy.cps.NonCPS
@NonCPS
@CoRfr
CoRfr / build-ipxe-rpi.sh
Last active April 4, 2023 15:12
Build iPXE for Raspberry Pi (4)
#!/bin/bash -xe
# To build in 64bit mode
if ! command -v aarch64-linux-gnu-gcc; then
sudo apt-get install gcc-aarch64-linux-gnu
fi
if ! command -v mformat; then
sudo apt-get install mtools
fi
@CoRfr
CoRfr / gist:cba517871500ea1abaf054ab85ae1dad
Last active September 20, 2019 23:10 — forked from cheethoe/gist:49d9c1d0003e44423e54a060e0b3fbf1
Rook v0.8.0 device/osd removal
# This will use osd.5 as an example
# ceph commands are expected to be run in the rook-toolbox
1) disk fails
2) remove disk from node
3) mark out osd. `ceph osd out osd.5`
4) remove from crush map. `ceph osd crush remove osd.5`
5) delete caps. `ceph auth del osd.5`
6) remove osd. `ceph osd rm osd.5`
7) delete the deployment `kubectl delete deployment -n rook-ceph rook-ceph-osd-5`
8) delete osd data dir on node `rm -rf /var/lib/rook/osd5`
@CoRfr
CoRfr / list-gerrit-users.sh
Last active April 24, 2023 07:30
List Gerrit users with NoteDB
#!/bin/bash -e
if ! [ -e "All-Users" ]; then
[ -n "$GERRIT_GIT_PATH" ] || ( echo "GERRIT_GIT_PATH not set" && exit 1 )
git clone "${GERRIT_GIT_PATH}/All-Users.git"
fi
cd All-Users
rm -f /tmp/users.csv
set +e
@CoRfr
CoRfr / list-libs.sh
Created January 18, 2019 22:33
Find all lib dependencies of a sub-dir that are not contained in that dir
#!/bin/bash
dir=$1
for file in $(find "$dir" -name "lib*.so" -or -wholename "*/bin/*"); do
objdump -x $file 2>/dev/null | grep NEEDED
done | sort -u | awk '{print $2}' > /tmp/all-libs
while read -r -u 10 lib; do
( find "$dir" -name "$lib" -print0 | grep -qz . ) || echo "$lib"
done 10</tmp/all-libs
@CoRfr
CoRfr / compare-so.sh
Last active March 12, 2018 23:20
cmp-so
#!/bin/bash -e
if [ -z "$OBJDUMP" ]; then
OBJDUMP="$(which objdump)"
echo "Using $OBJDUMP"
fi
LEFT=$1
RIGHT=$2
@CoRfr
CoRfr / fix-admin.sh
Last active February 20, 2018 09:19
Update Gerrit Administrators group id
#!/bin/bash
set -e
GIT_ROOT=${GIT_ROOT:-"/storage/git"}
TMP_GIT=${TMP_GIT:-"/home/core/test"}
OLD_ID=$1
NEW_ID=$2
#!/bin/bash
# This shell script allows you to maintain a local cache of public images.
#
# Just add your images in CACHE_IMAGES, and it will push the image to the
# registry specified in LOCAL_REGISTRY.
# The / in the origin image name is replaced by a -.
# google/cadvisor => local_registry:5000/google-cadvisor
#
# If you want to rename the destination image, just specify the destination name
# after a comma. For instance: