Skip to content

Instantly share code, notes, and snippets.

View freyes's full-sized avatar
🥑

Felipe Reyes freyes

🥑
View GitHub Profile
#!/bin/bash
# Just a wrapper to deal with charms branches in my own customized way
# use it under your own risk!.
# Example:
# $ charm-branch ceph lp1449279 next
# bzr branch lp:~openstack-charmers/charms/trusty/ceph/next ceph.lp1449279
# Branched 106 revisions.
set -e
CHARM_DEVEL_ROOT=$HOME/Projects/charms/devel
if [ ! -d $CHARM_DEVEL_ROOT ]; then
@freyes
freyes / pa-def-sink
Created May 15, 2015 13:31
List sinks and change the default one
#!/bin/bash
# Example:
# $ pa-def-sink
# * index: 0
# name: <alsa_output.pci-0000_00_03.0.hdmi-stereo>
# index: 1
# name: <alsa_output.usb-Sony_Computer_Entertainment_Wireless_Stereo_Headset-00-Headset.iec958-stereo>
# index: 2
# name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
# $ pa-def-sink 1
@freyes
freyes / lp.py
Created May 29, 2015 20:59
willie bot module to display launchpad bugs
"""
lp.py - Willie Launchpad Module
Copyright (C) 2015 Felipe Reyes <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@freyes
freyes / sosreport-find-and-del
Created August 17, 2015 14:12
Find extracted sosreport and remove them
#!/bin/bash -e
#
# Find extracted sosreport and remove them
#
for i in $(find . -name 'sosreport-*' -type d); do
test -f "${i}.tar.xz" && echo -n "Removing ${i}..." && sudo rm -rf "${i}" && echo "done"
done
@freyes
freyes / bt-a2dp-toggle
Created August 20, 2015 17:45
toggle my bluetooth headset between a2dp and hsp profiles, I binded this command to my keyboard for easy access
#!/bin/bash -ex
CARD_NAME="bluez_card.0C_E0_E4_64_23_27"
SINK_NAME="bluez_sink.0C_E0_E4_64_23_27"
pacmd list | grep "$SINK_NAME.a2dp" && pacmd set-card-profile $CARD_NAME hsp && pacmd set-default-sink "$SINK_NAME.hsp" && exit 0
pacmd list | grep "$SINK_NAME.hsp" && pacmd set-card-profile $CARD_NAME a2dp && pacmd set-default-sink "$SINK_NAME.a2dp" && exit 0
@freyes
freyes / auth.py
Created January 6, 2016 21:28 — forked from niedbalski/auth.py
hmac-encrypt-request
from Crypto.Hash import HMAC
from Crypto.Hash import SHA
import hashlib
import datetime
class Auth:
@classmethod
def sign(cls, method, c_type, body, uri, key=None):
@freyes
freyes / juju-change-unit-status
Created February 24, 2016 16:58
[juju] change unit status from dying to active
1) Connect to machine 0 as root
juju ssh 0 sudo su -
2) Install mongodb client
apt-get install mongodb-clients
3) Connect to mongodb
mongo --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
4) Use juju db
use juju
5) Change status
db.units.update({"name": "UNIT"}, {$set: {"life": 0}});
@freyes
freyes / juju-change-action-state
Last active February 24, 2016 17:01
[juju] set pending actions to cancelled
1) Connect to machine 0 as root
juju ssh 0 sudo su -
2) Install mongodb client
apt-get install mongodb-clients
3) Connect to mongodb
mongo --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
4) Use juju db
use juju
5) Change state
db.actions.update({"receiver": "UNIT", "status": "pending"}, {$set: {"status": "cancelled"}}, {multi: true});
# vim: set ts=2 et:
# deployer bundle for stable charms
# UOSCI relies on this for OS-on-OS deployment testing
openstack-services:
services:
mysql:
branch: lp:charms/trusty/percona-cluster
constraints: mem=1G
options:
dataset-size: 50%
@freyes
freyes / gist:0f139d055024b9c6e56f
Created March 9, 2016 16:21
[OpenStack] find vm by UUID inside a compute node
for i in $(virsh list --all | awk -F' ' '{print $2}' | grep instance);do virsh dumpxml $i | grep -q 34f013fa-7275-489d-8152-4f5118a43b64 && echo $i ;done