Skip to content

Instantly share code, notes, and snippets.

View mfojtik's full-sized avatar

Michal Fojtik mfojtik

View GitHub Profile
π ~/go/src/github.com/openshift/origin ./hack/test-extended/s2i/run.sh
[INFO] Compiling test/extended package ...
# github.com/openshift/origin/pkg/cmd/cli/config
pkg/cmd/cli/config/loader.go:8: inconsistent definition for type pflag.Flag during import
struct { Name string; Shorthand string; Usage string; Value pflag.Value; DefValue string; Changed bool; NoOptDefVal string; Deprecated string; Annotations map[string][]string } (in "github.com/openshift/origin/pkg/cmd/util")
struct { Name string; Shorthand string; Usage string; Value pflag.Value; DefValue string; Changed bool; Deprecated string; Annotations map[string][]string } (in "github.com/spf13/cobra")
pkg/cmd/cli/config/loader.go:8: inconsistent definition for type cobra.Command during import
struct { name string; Use string; Aliases []string; Short string; Long string; Example string; ValidArgs []string; BashCompletionFunction string; Deprecated string; flags *pflag.FlagSet; pflags *pflag.FlagSet; lflags *pflag.FlagSet; PersistentPreRun func(*cobra.
@mfojtik
mfojtik / test.rb
Created February 19, 2014 12:12
bla
# var_name moze byt LD_LIBRARY_PATH a PATH
# v 'env' => ["OPENSHIFT_MOCK_PATH_ELEMENT", "OPENSHIFT_MOCK_LD_LIBRARY_PATH_ELEMENT"]
elements = env.keys.find_all { |name|
name =~ /^OPENSHIFT_.*_#{var_name}_ELEMENT/ and name != primary_path
}.each_with_object([]) { |s, p| p << env[s] }
@mfojtik
mfojtik / devenv-sync
Created February 21, 2014 10:50
devenv-sync
#!/bin/bash
bold=`tput bold`
normal=`tput sgr0`
devenv() {
pushd /home/mfojtik/code/rh/li &>/dev/null
./build/devenv "$@"
popd &> /dev/null
}
@mfojtik
mfojtik / server.js
Created February 21, 2014 13:41
Script to verify the mysql+nodejs works
#!/bin/env node
// OpenShift sample Node application
var express = require('express');
var fs = require('fs');
var mysql = require('mysql');
/**
* Define the sample application.
*/
var SampleApp = function() {
@mfojtik
mfojtik / application
Created February 21, 2014 14:00
Python application
#!/usr/bin/python
import os
import psycopg2
virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
def update_ld_library_paths
db_carts = [ 'postgresql-9.2', 'mysql-5.5' ]
Application.where({"scalable" => true}).each do |app|
if app.component_instances.any? { |c| db_carts.include?(c.component_name) }
begin
app.execute_connections
rescue => e
puts "Failed to execute_connections for #{app._id} (ERR: #{e.message})"
end
app_ids = Application.where({"scalable" => true}).find_all { |app|
app.component_instances.any? { |c|
c.is_embeddable? && db_carts.include?(c.component_name)
}
}.map { |a| a.id }
@mfojtik
mfojtik / gist:9491948
Created March 11, 2014 18:26
snapshot-restore on started application
# rhc app create ruby12 -s mysql-5.5 postgresql-9.2
Application Options
-------------------
Domain: mfojtik
Cartridges: ruby-1.9, mysql-5.5, postgresql-9.2
Gear Size: default
Scaling: yes
Creating application 'ruby12' ... done
@mfojtik
mfojtik / gist:9492392
Created March 11, 2014 18:47
snapshot-restore on stopped application
# rhc app create ruby13 -s mysql-5.5 postgresql-9.2
Application Options
-------------------
Domain: mfojtik
Cartridges: ruby-1.9, mysql-5.5, postgresql-9.2
Gear Size: default
Scaling: yes
Creating application 'ruby13' ... done
@mfojtik
mfojtik / gist:11293743
Created April 25, 2014 15:34
build image from container
~/code/rh/docker-image-examples/centos-ruby → docker run -v /var/run:/var/run mfojtik/centos-ruby:extended /bin/sti build git://github.com/mfojtik/sinatra-app-example mfojtik/centos-ruby:extended my-app --debug
2014/04/25 15:33:52 Using docker socket: unix:///var/run/docker.sock
2014/04/25 15:33:52 Clean build will be performed
2014/04/25 15:33:52 Performing source build from git://github.com/mfojtik/sinatra-app-example
2014/04/25 15:33:52 Fetching git://github.com/mfojtik/sinatra-app-example to directory /tmp/sti307542252/src
2014/04/25 15:33:52 Creating container using config: {Hostname: Domainname: User:root Memory:0 MemorySwap:0 CpuShares:0 AttachStdin:false AttachStdout:false AttachStderr:false PortSpecs:[] ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[] Cmd:[/usr/bin/prepare] Dns:[] Image:mfojtik/centos-ruby:extended Volumes:map[/tmp/src:{}] VolumesFrom: WorkingDir: Entrypoint:[] NetworkDisabled:false}
2014/04/25 15:33:53 Starting container with config: {Binds:[/tmp/sti307542252/src