Skip to content

Instantly share code, notes, and snippets.

@zioproto
zioproto / redis-delete-old-keys.py
Last active March 3, 2023 18:45
Delete Redis Stale Keys
#!/usr/bin/env python
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
# To debug code on a single key you can use this instead of the for loops:
# key = r.randomkey()
# Delete all keys not accessed since 'idletime'
for key in r.scan_iter("*"):
idle = r.object("idletime", key)
@zioproto
zioproto / server_with_floatingip.yaml
Created August 6, 2018 08:28
Openstack Heat Server with Floating IP
heat_template_version: 2013-05-23
description: HOT to deploy a single instance, within its network, with a floating IP
parameters:
vm_key:
type: string
label: "SSH key name (must exist)"
default: macsp
vm_flavor:
@zioproto
zioproto / pre-commit
Created July 4, 2018 11:50
Git hook to avoid committing a decrypted ansible vault
#!/bin/bash
git show :group_vars/all/vault | grep ^'$ANSIBLE_VAULT'
export encrypted=$?
if [ $encrypted -ne 0 ]; then
echo Ansible Vault not encrypted, refusing to commit
exit 1
fi
@zioproto
zioproto / gitconfig
Last active December 21, 2022 12:38
gitconfig
[user]
name = Saverio Proto
email = zioproto@gmail.com
[core]
editor = vim
autocrlf = input
[color]
diff = auto
@zioproto
zioproto / genesis_public_key
Created March 13, 2018 20:47
genesis_public_key
04b5d60c1db6371eec9515a8a60a2e58f0fba2cf90c1a847e8768d61ccc5b258fd468f11c4648c5966416c42fbfe946846216e5a08c9f7bf57c1fbb3eabc7810d2;haniehrajabi
#
# Example of a user's .screenrc file
#
# This is how one can set a reattach password:
# password ODSJQf.4IJN7E # "1234"
# no annoying audible bell, please
vbell off
@zioproto
zioproto / k8s-mysql-cinder.yaml
Last active September 25, 2019 20:57
Kubernetes on Openstack Mysql service with Cinder persistent volume claim
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: default
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/cinder
---
kind: PersistentVolumeClaim
@zioproto
zioproto / server.py
Last active November 15, 2017 13:52
Check instances are really up with Cloud-Init
#!/usr/bin/env python
"""
Boot the VMs with the following cloud-init, and then start this code:
#cloud-config
phone_home:
url: http://x.x.x.x:8000/$INSTANCE_ID/
post: [ hostname, fqdn ]
"""
@zioproto
zioproto / lp1671693.patch
Created May 29, 2017 07:39
lp1671693.patch
commit 99f7c8c9ad26539473f65f30547ba548c02ab4fe
Author: Mark Mielke <mark.mielke@gmail.com>
Date: Thu Mar 9 23:16:51 2017 -0500
Image list function should normalize owner filter
The api.glance.image_list_detailed() function accepts a list of
filters which it then translates into a form that is acceptable for
Glance v1 or Glance v2. These translations included support for
mapping 'is_public' to 'visibility', but did not include support for
@zioproto
zioproto / badidea.patch
Created May 29, 2017 07:38
Workaround for bad defaults in Horizon Newton
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
index 391b8e7..42a8f50 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
@@ -419,7 +419,7 @@
ctrl.currentBootSource = selectedSource;
if ((selectedSource === bootSourceTypes.IMAGE ||
selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
- $scope.model.newInstanceSpec.vol_create = true;
+ $scope.model.newInstanceSpec.vol_create = false;