Skip to content

Instantly share code, notes, and snippets.

View freyes's full-sized avatar
🥑

Felipe Reyes freyes

🥑
View GitHub Profile
@freyes
freyes / mongo.sh
Last active March 27, 2024 18:25 — forked from niedbalski/mongo.sh
Connect to Juju 2.0 Mongodb
# valid for juju 2.0
# see https://bugs.launchpad.net/ubuntu/+source/juju-mongodb3.2/+bug/1583740
$ juju ssh -m controller 0
# when running a Xenial controller
/usr/lib/juju/mongo3.2/bin/mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
# when running a Bionic controller
mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
@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
@freyes
freyes / gist:dfc3f5232526a62bbc09adc816e0477d
Created April 11, 2016 12:42
bluetoothd: a2dp-sink profile connect failed for AA:BB:CC:DD:EE:00: Protocol not available
Source: https://g751jy.wordpress.com/about/parrot-zik-bluetooth-headset/
https://bbs.archlinux.org/viewtopic.php?id=194006
Cached: http://webcache.googleusercontent.com/search?q=cache:4stTobIXSD0J:https://g751jy.wordpress.com/about/parrot-zik-bluetooth-headset/+&cd=3&hl=en&ct=clnk&gl=us
Bug and possible solution: actually I found a bug in that make the headset unusable, it seems that the pulse audio module: module-bluetooth-discover works only if started after the X11 session is up. So I have a workaround.
Edit the file:
/etc/pulse/default.pa
@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):
#!/bin/bash
export VAULT_ADDR="http://`juju run --unit vault/0 unit-get private-address`:8200"
VAULT_INIT="$(vault operator init -key-shares=3 -key-threshold=3)"
for KEY in $(echo $VAULT_INIT | grep "Unseal Key " | cut -d' ' -f4); do
vault operator unseal $KEY
done
#!/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
@freyes
freyes / README.md
Last active February 7, 2023 15:11
Mirroring docker images for OpenStack Magnum deployments

Switch charmcraft aliases:

Usage examples:

charmcraft-workon 1.5
charmcraft-workon 2.0