Skip to content

Instantly share code, notes, and snippets.

View sustr4's full-sized avatar

Zdeněk Šustr sustr4

View GitHub Profile
before(:each) do
require './spec/occi/api/client/auth_details.rb'
@client = Occi::Api::Client::ClientHttp.new({
:endpoint => in_endpoint,
:auth => in_auth,
:log => { :out => "/dev/null",
:level => Occi::Log::DEBUG },
:auto_connect => true,
:media_type => "text/plain,text/occi"
})
#!/bin/sh
#Early steps, just to be sure
apt-get update
apt-get upgrade -y
#NFS Server -- Cargo Cult ;-)
apt-get install -y nfs-kernel-server
echo '/var/lib/one *(rw,sync,no_subtree_check,root_squash,anonuid=9869,anongid=9869)' >> /etc/exports
@sustr4
sustr4 / vomses.sh
Created March 24, 2014 12:46
VOMS Example
#!/bin/bash
mkdir /etc/vomses
echo '"vo.org" "emicert-voms.civ.zcu.cz" "15000" "/DC=org/DC=terena/DC=tcs/OU=Domain Control Validated/CN=emicert-voms.civ.zcu.cz" "vo.org"' > /etc/vomses/emicert-voms.civ.zcu.cz
@sustr4
sustr4 / voms-install-SL6.sh
Last active September 24, 2015 15:13
Install VOMS and create a testing VO
#!/bin/sh
#INSTALL EPEL, UMD and VOMS
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://repository.egi.eu/sw/production/umd/3/sl6/x86_64/updates/umd-release-3.0.1-1.el6.noarch.rpm
yum install -y voms-server yum-priorities voms-admin-client voms-admin-server mysql-server voms-mysql-plugin xml-commons-apis
service mysqld start
/usr/bin/mysqladmin -u root password [Edited];
@sustr4
sustr4 / yaml2totals.rb
Created December 2, 2015 09:32
Generate temporal sequence from clouditor exports. Totals are recalculated for each second whence at least one change occurred.
require 'yaml'
data = YAML.load_file("vm_records_export.yml")
cpu_timeline = Hash.new
mem_timeline = Hash.new
now = Time.now.to_i
data.each { |rec|
@sustr4
sustr4 / yaml2usage.rb
Created December 2, 2015 09:37
Add-up week-by-week usage of resources, based on YAML exported from Clouditor.
require 'yaml'
data = YAML.load_file("vm_records_export.yml")
# 1 Jan 2014: 1388534400
# 1 Jan 2015: 1420070400
# 1 week: 604800
weeks = Array.new(54, 0.0)
@sustr4
sustr4 / yaml2csv.rb
Created December 2, 2015 09:54
Convert hierarchical YAML from Clouditor to sequential CSV for further processing in spreadsheets. Each run segment on a separate line.
require 'yaml'
data = YAML.load_file("vm_records_export.yml")
puts "id,user,group,name,memory,vcpu,cpu,hostname,start_time,end_time,host_info.vcpu,host_info.memory,host_info.model"
data.each { |rec|
rec["runtime"].each { |runtime|
puts "#{rec["id"]},#{rec["user"]},#{rec["group"]},#{rec["name"]},#{rec["memory"]},#{rec["vcpu"]},#{rec["cpu"]},#{runtime["hostname"]},#{runtime["start_time"]},#{runtime["end_time"]},#{runtime["host_info"]["vcpu"]},#{runtime["host_info"]["memory"]},#{runtime["host_info"]["model"]}"
@sustr4
sustr4 / create_VOMSes.sh
Last active June 1, 2017 10:59
create_VOMSes.sh
#For SL6:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install yum-priorities
rpm -ivh http://repository.egi.eu/sw/production/umd/3/sl6/x86_64/updates/umd-release-3.14.4-1.el6.noarch.rpm
yum install -y mysql-server voms-admin-server voms-admin-client emi-voms-mysql ca-policy-egi-core
/etc/init.d/mysqld start
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('[Edited]');"
mysql --user=root --password=[Edited] -e "create database voms_training_egi_eu"
@sustr4
sustr4 / gist:10f334fa58c22907ec6bc6c97f827469
Last active February 25, 2020 12:20
Replicate Travis-ci
export BUILDID="build-14688"
export INSTANCE="travisci/ci-sardonyx:packer-1576238197-60d50014"
sudo docker run --name $BUILDID -dit $INSTANCE /sbin/init
sudo docker exec -it $BUILDID bash -l
su - travis
@sustr4
sustr4 / Makefile
Created April 8, 2020 11:31
Copernicus coverage heatmap
all:
gnuplot -c heatmap2d.gnu