Skip to content

Instantly share code, notes, and snippets.

View knikolla's full-sized avatar
🐢

Kristi Nikolla knikolla

🐢
View GitHub Profile
@knikolla
knikolla / PowerPoll.py
Created February 7, 2016 18:14
Send a dbus message to upower to refresh device state every 5 seconds.
#!/usr/bin/python
# There is an issue with the power indicator on rMBP 13".
# upower doesn't indicate AC/Batt event change until it polls
# the device after 30 seconds of inactivity.
# Since 30 seconds is too long, using this script I force it
# to refresh after 5 seconds by using the dbus.
import os
import time
while True:
[knikolla@lenovo-moc1 k2k-openstackclient]$ git diff master..k2k
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py
index 56ddcba..0295116 100644
--- a/openstackclient/common/clientmanager.py
+++ b/openstackclient/common/clientmanager.py
@@ -205,6 +205,31 @@ class ClientManager(object):
if not self._auth_ref:
self.setup_auth()
LOG.debug("Get auth_ref")
+
@knikolla
knikolla / Vagrantfile
Created May 19, 2016 16:30
toxman Vagrant
$bootstrap = <<SCRIPT
sudo apt-get update
sudo apt-get install -y git \
python-pip python-dev python3-dev \
libxml2-dev libxslt1-dev libpq-dev libffi-dev libldap2-dev \
libsasl2-dev
sudo pip install tox
SCRIPT
Vagrant.configure("2") do |config|
@knikolla
knikolla / ssh-tox.sh
Last active March 23, 2018 19:52
Rsync the current directory to a remote location and execute tox
#!/usr/bin/env bash
# ENV variables required:
# SSH_DEST: destination directory as would have been specified
# to rsync or scp. ex. [email protected]:~
# Get the name of the target directory
TARGET=$(basename `pwd`)
# Clean up
rm -rf .tox

Keybase proof

I hereby claim:

  • I am knikolla on github.
  • I am knikolla (https://keybase.io/knikolla) on keybase.
  • I have a public key ASBZ4jnfZNPLrMUgR7HcMwBs9LiDNAEzhmlX3bO_sTe7vQo

To claim this, I am signing this object:

@knikolla
knikolla / settings.json
Last active November 28, 2017 19:52
Visual Studio Code Settings
{
"files.exclude": {
"**/*.pyc": true,
".testrepository": true,
".tox": true,
"*.egg-info": true,
"__pycache__": true
},
"workbench.iconTheme": "ayu",
"workbench.colorTheme": "Ayu Mirage",
#!/usr/bin/env bash
openssl genrsa -out my.key 2048
openssl req -new -x509 -days 1826 \
-key my.key -out my.crt \
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
@knikolla
knikolla / brookline_tab_feeds.txt
Created July 9, 2018 15:19
Brookline Tab RSS Feeds (Useful for fetching news with Calibre)
http://brookline.wickedlocal.com/news?template=rss&mime=xml
http://brookline.wickedlocal.com/business-news?template=rss&mime=xml
http://brookline.wickedlocal.com/entertainment?template=rss&mime=xml
http://brookline.wickedlocal.com/lifestyle?template=rss&mime=xml
http://brookline.wickedlocal.com/opinion?template=rss&mime=xml
@knikolla
knikolla / rewrite_openstack_endpoints.py
Created May 5, 2020 21:56
Finds and replaces a term in OpenStack endpoints
# This script finds and replaces a term in the urls of endpoints.
# This is useful because you cannot install Devstack with a
# hostname or domain name, so devstack gets installed with an ip
# and then the script replaces that with a hostname.
import openstack
openstack.enable_logging(debug=False)
cloud = openstack.connect(cloud='devstack')
@knikolla
knikolla / disable.sh
Last active August 18, 2021 15:00
Using `os purge` to delete OpenStack projects
alias kaizen="openstack --os-cloud kaizen"
kaizen project show $1
kaizen project set --disable $1
echo "Servers for $1"
kaizen server list --project $1
echo "Networks for $1"
kaizen network list --project $1