Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / openstack.sh
Created April 12, 2017 11:48 — forked from prasetiyohadi/openstack.sh
Openstack commands example
#!/bin/bash
# load authentication key
cd $HOME
source keystonerc_admin
# list neutron routers
neutron router-list --max-width 50
# remove router gateway
@epcim
epcim / toggleIP.sh
Created April 12, 2017 11:51 — forked from jbestell/toggleIP.sh
Openstack: Use python-novaclient commands to disassociate/reassociate a floating IP with an instance to correct connectivity issues.
!/bin/bash
togglefloaterByUUID() {
floater=$(nova show $1 | grep network | awk -F "|" '{printf $3}' | awk -F ", " '{printf $NF}' | sed -e 's/ //g' | sed ':a;N;$!ba;s/\n/ /g');
if [ -z $floater ]; then
echo $1": No floating IP association found.";
else
name=$(nova show $1 | grep ' name ' | awk -F "|" '{printf $3}' | sed -e 's/ //g' | sed ':a;N;$!ba;s/\n/ /g');
echo "Dis-associating floating IP" $floater "from instance" $name "("$1")...";
@epcim
epcim / new_tenant.sh
Created April 12, 2017 11:51 — forked from jriguera/new_tenant.sh
Openstack CLI commands to create a new Project/Tenant and networks using identity V3 (with groups)
# Now we are managing the users on a project by using groups. So everything
# is about creating users and add they to the groups.
# A special user is created always with the same name of the project,
# just to reserve the name and avoid confusion and have an email.
############## Define those variables for the tenant (this is just an example)
TENANT=test
PASSWORD=test
TENANT_DESC="Test"
@epcim
epcim / list-dockerhub-images.sh
Created April 12, 2017 11:53 — forked from jriguera/list-dockerhub-images.sh
Listing Docker images in DockerHub
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@epcim
epcim / delete-dockerhub-images.sh
Created April 12, 2017 11:53 — forked from jriguera/delete-dockerhub-images.sh
Delete Docker images on DockerHub
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@epcim
epcim / webex-ubuntu.md
Created April 27, 2017 08:42 — forked from mshkrebtan/webex-ubuntu.md
Run Cisco Webex on 64-bit Ubuntu 16.04

Run Cisco Webex on 64-bit Ubuntu 16.04

With Audio and Screen Sharing Enabled

Enable support for 32-bit executables

Add the i386 architecture to the list of dpkg architectures :

sudo dpkg --add-architecture i386
@epcim
epcim / install-pre-commit.sh
Last active May 24, 2017 10:15 — forked from stefansundin/install-pre-commit.sh
Git pre-commit hook / check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are four variants that I have built:
# - pre-commit: stops commits to "master" and "develop" branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: stop SaltMaster direct reclass branch commits.
# Set desired version like this before installing:
# FILE=pre-commit
@epcim
epcim / gist:fde8c4869fd179e03cfbfefb36c061c0
Last active May 5, 2017 11:35 — forked from SEJeff/gist:4207694
Testing jinja from the python interactive shell
from jinja2 import Template
tmpl = """{% if name != "Jeff" %}Nothing to see here move along{% else %} ... hello {{name}}, how are you?{% endif %}"""
template = Template(tmpl)
print template.render({"name": "Jeff"})
# hello Jeff, how are you?
print template.render({"name": "John"})
# Nothing to see here move along
import getopt
import pycassa
import subprocess
import sys
from pycassa.pool import ConnectionPool
from pycassa.columnfamily import ColumnFamily
def query_typename(column, typename):
data = column.get(typename.replace('-', '_'))