Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
@allomov
allomov / update-git.sh
Last active February 15, 2017 23:20
copy one git repos to another
#!/bin/bash
# LOAD Functions and common vars
source ./func.sh
# ssh-agent /bin/bash -c " << EOF
# ssh-add ~/.ssh/id_rsa_git
if ! ssh -T -o PasswordAuthentication=no git@.... 1> /dev/null;
then
require './spec/spec_helper'
require "rspec/mocks/standalone"
type = :filter
previous_transform = double()
manifest = YAML.load_file(assets_path("transforms", "manifest.yml"))
allow(previous_transform).to receive(:result) { Mantra::Manifest::Element.create(manifest) }
options = {"sections" => [ "releases" ]}
transform = Mantra::Transform.create(options.merge(type: type, previous_transform: previous_transform))
transform.run
---
instances_groups:
- name: sample
network:
- name: does-not-matter
static_ips: ((static-ips))
{
"ListenAddress": "0.0.0.0",
"ListenPort": 8080,
"Username": "turbulence",
"Password": "generated-password",
"CertificatePath": "/var/vcap/jobs/turbulence_api/config/cert",
"PrivateKeyPath": "/var/vcap/jobs/turbulence_api/config/private_key",
"Director": {
"Host": "some-bosh-ip-address",
"Port": 25555,
workers_list=$(bosh vms --json | jq '.Tables | .[0].Rows | map(.[0])' | grep worker | tr -d "\",\ ")
echo "Recreating following workers: "
echo "$workers_list"
while read -r worker; do
bosh recreate -f "$worker"
done <<< "$workers_list"
@allomov
allomov / env
Last active April 12, 2017 16:28
→ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
→ thrift -version
Thrift version 0.10.0
→ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_102, vendor: Oracle Corporation
BOSH_CLIENT=...
BOSH_CLIENT_SECRET=...
UAA_TOKEN=$(curl --cacert $BOSH_CA_CERT -v -X POST --data "grant_type=client_credentials&client_id=$BOSH_CLIENT&client_secret=$BOSH_CLIENT_SECRET" "https://$BOSH_HOST:8443/oauth/token" | jq .access_token | sed -e 's/\"//g')
curl -v -s -k -H "Authorization: bearer $UAA_TOKEN" "https://$BOSH_USER:$BOSH_PASSWORD@$BOSH_HOST:25555/tasks"
manifest_path = "/Users/allomov/work/altoros/github/mantra/spec/assets/integration/manifest.yml"
manifest = Mantra::Manifest.new(manifest_path)
job_properties_array = manifest.jobs.map do |job|
job.hash? ? job.content["properties"] : nil
end.compact
job_properties = Mantra::Manifest::Element.create({}).content

You can use HTML comments <!-- .... -->. (See the source code of this answer for an example). Please do not misuse this feature. Temporary disabling some parts of a post should be OK.

You can use HTML comments <!-- .... -->. (See the source code of this answer for an example). Please do not misuse this feature. Temporary disabling some parts of a post should be OK.