Skip to content

Instantly share code, notes, and snippets.

View arax's full-sized avatar

Boris Parak arax

  • Brno, Czech Republic
View GitHub Profile
@arax
arax / OIDC.jpg
Last active October 23, 2023 17:31
OpenStack with OpenID Connect and OAuth 2.0
OIDC.jpg
@arax
arax / sys_explore.sh
Created May 20, 2018 10:44
Script gathering various internal data for system diagnostics and performance tuning
#!/bin/bash
{ top -n 5 -b > /tmp/top.out; vmstat 1 50 > /tmp/vm.out; iostat -tkx -p ALL 1 10 > /tmp/io.out; mpstat -A 1 10 > /tmp/mp.out; ps auwwx > /tmp/ps1.out; ps axHo %cpu,stat,pid,tid,pgid,ppid,comm,wchan > /tmp/ps2.out; sar -A 1 50 > /tmp/sar.out; free > /tmp/free.out; }
tar -cjvf outputs_$(hostname)_$(date +"%d-%b-%Y_%H%M").tar.bz2 /tmp/*.out
@arax
arax / git-delete-tags.sh
Created November 10, 2017 17:46
HowTo Delete git Tags - local & remote
TAGS=$(git tag | grep v4) # filter out tags to remove
for TAG in $TAGS ; do
git tag -d "$TAG" # remove local
git push origin :refs/tags/"$TAG" # remove from origin (remote)
done
@arax
arax / toggleTouchpad.sh
Created September 20, 2015 17:01
Toggle the touchpad (on/off)
#!/bin/bash
###########################################################################
## toggleTouchpad.sh
##
## Toggle the touchpad on/off.
###########################################################################
# Get the id number of the touchpad.
tp_id=`xinput list | grep -i touchpad | awk '{ print $6 }' | sed 's/id=//'`
@arax
arax / gist:5597702
Last active December 17, 2015 10:49
rOCCI -- parsing error from invalid Action rendering (rOCCI-server v0.5.x) and SecGroup mixin (OCCI-OS)
# Action
~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:134:in `category': could not match Category: down;scheme="http://schemas.ogf.org/occi/infrastructure/network/action#up";class="action";title="Activate network" (RuntimeError)
from ~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:73:in `block in categories'
from ~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:71:in `each'
from ~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:71:in `categories'
from ~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser.rb:41:in `parse'
# Security group from OCCI-OS
~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:134:in `category': could not match Category: 36; scheme="http://schemas.openstack.org/infrastructure/security/group#"; class="mixin"; title="default"; rel="http://schemas.ogf.org/occi/infrastructure/security#group"; location="/security/default/" (RuntimeError)
@arax
arax / gist:5561005
Created May 11, 2013 19:01
rOCCI -- parsing error from the new parser
~/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:134:in `category': could not match Category: egicf2012_demo;scheme="https://occi.schema/occi/infrastructure/os_tpl#";class="mixin";title="egicf2012-demo";rel="http://schemas.ogf.org/occi/infrastructure#os_tpl";location="/mixins/egicf2012_demo/" (RuntimeError)
from /home/arax/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:73:in `block in categories'
from /home/arax/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:71:in `each'
from /home/arax/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser/text.rb:71:in `categories'
from /home/arax/.rvm/gems/ruby-1.9.3-p392/gems/occi-3.2.0.alpha.1/lib/occi/parser.rb:41:in `parse'
@arax
arax / gist:5527509
Created May 6, 2013 19:31
HTTPi with curb and SPNEGO, based on https://gist.github.com/pullmonkey/3179054
require 'rubygems'
require 'httpi'
require 'curb'
require 'pp'
require 'json'
################################
# kinit user@REALM
# kinit -k -t /ticket/path
################################
@arax
arax / gist:5013092
Created February 22, 2013 12:29
rOCCI-server v0.5.3/rOCCI v2.5.13 crash on POST /compute/
Category: compute;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"
Category: small;scheme="https://occi.my.scheme/occi/infrastructure/resource_tpl#";class="mixin"
X-OCCI-Attribute: occi.core.title="My Test VM"
Link: </storage/e60aa2b8-0c86-5973-b93e-30c5c46d6eac>;rel="http://schemas.ogf.org/occi/infrastructure#storage";category="http://schemas.ogf.org/occi/infrastructure#storagelink";occi.core.target="/storage/e60aa2b8-0c86-5973-b93e-30c5c46d6eac"
Link: </network/e4bd81c4-adda-5626-840d-39bb7959db97>;rel="http://schemas.ogf.org/occi/core#resource";category="http://schemas.ogf.org/occi/infrastructure#networkinterface";occi.core.target="/network/e4bd81c4-adda-5626-840d-39bb7959db97"
D, [2013-02-22T13:20:35.249918 #31553] DEBUG -- : ### Prepare response ###
D, [2013-02-22T13:20:35.250061 #31553] DEBUG -- : ### Initialize response OCCI collection ###
D, [2013-02-22T13:20:35.250307 #31553] DEBUG -- : ### Reset OCCI model ###
@arax
arax / gist:4731144
Last active December 12, 2015 06:39
Reading PKCS#12 credentials in jRuby using Java's java.security.KeyStore
require 'java'
require 'highline/import'
keystore = Java::JavaSecurity::KeyStore.getInstance("PKCS12")
path = ask "Enter full path to the PKCS#12 file: "
fis = Java::JavaIo::FileInputStream.new(path)
password = ask("Enter you PKCS#12 password: ") { |q| q.echo = false }
password = Java::JavaLang::String.new(password).to_char_array
@arax
arax / CloudAuth.rb
Last active December 12, 2015 05:29
OpenNebula -- fix for X.509 authn username lookup in src/cloud/common/CloudAuth.rb
# Gets the username associated with a password
# password:: _String_ the password
# [return] _Hash_ with the username
def get_username(password)
xpath = "USER[PASSWORD=\"#{password}\"]/NAME"
username = retrieve_from_userpool(xpath)
# No exact match, trying to match password with each
# of the pipe-separated DNs stored in USER/PASSWORD
if username.nil?