Skip to content

Instantly share code, notes, and snippets.

View freyes's full-sized avatar
🥑

Felipe Reyes freyes

🥑
View GitHub Profile
@freyes
freyes / git-cherry-pick-openstack.sh
Created September 28, 2023 13:57
Helper script to propose backports for OpenStack projects
#!/bin/bash -eux
#
# Usage:
# ./git-cherry-pick-openstack <COMMIT> <TOPIC> <TARGET>
#
# Example:
# ./git-cherry-pick-openstack 83ffa9eb3a2418897bf2707d14efce725d775090 bug/2030094 ussuri
COMMIT_ID=${1}
TOPIC=${2}

Steps to test:

  1. Setup model-default to always include the ppa
    cat << EOF > model-config.yaml
    #cloud-config
    apt:
      sources:
        lp2023211:
          source: 'ppa:freyes/lp2023211'
    
#!/usr/bin/env python3
#
# Usage example:
# python3 client.py "ws://127.0.0.1:6083/?token=5f7854b7-bf3a-41eb-857a-43fc33f0b1ec"
#
import sys
from ws4py.client.threadedclient import WebSocketClient
class LazyClient(WebSocketClient):
@freyes
freyes / 01-setup.sh
Last active March 19, 2024 16:37
Squid configured to be very aggressive at caching deb packages and other artifacts that are known to not change over time
echo "DEBOOTSTRAP_PROXY=http://localhost:3128/" >> ~/.mk-sbuild.rc
#!/usr/bin/python3
"""A script to retrieve a Launchpad token."""
import argparse
import os
import sys
from unittest import mock
from launchpadlib.launchpad import Launchpad

Switch charmcraft aliases:

Usage examples:

charmcraft-workon 1.5
charmcraft-workon 2.0
@freyes
freyes / README.md
Last active February 7, 2023 15:11
Mirroring docker images for OpenStack Magnum deployments
#!/bin/bash -eu
CHANNELS=()
ARCH=amd64
SERIES=()
CONFIG=
DEBUG=0
CHARMS=()
while (($# > 0))
def _get_machine_id():
"""Return the machine-id UUID."""
with open('/etc/machine-id', 'r') as f:
# The machine ID is a single newline-terminated, hexadecimal,
# 32-character, lowercase ID.
machine_id_int = int(f.read().strip(), 16)
machine_id_bytes = bytearray(machine_id_int.to_bytes(16, 'big'))
# see manpage machine-id(5)
machine_id_bytes[6] = (machine_id_bytes[6] & 0x0F) | 0x40
machine_id_bytes[8] = (machine_id_bytes[8] & 0x3F) | 0x80
#!/bin/bash -eu
SOSREPORT=$1
shift
FILE_PATH="$@"
SOSREPORT_NAME=$(basename $SOSREPORT)
SOSREPORT_NAME=${SOSREPORT_NAME%.tar.xz}
FILES=""
for F in ${FILE_PATH}; do