Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
brew tap cloudfoundry/tap
brew install bosh-cli
brew link --overwrite bosh-cli
wget https://github.com/concourse/concourse/releases/download/v3.8.0/concourse-lite.yml
bosh create-env concourse-lite.yml

Find the service by name

tasklist | Select-String -Pattern "Dev*"
Find-Package -ProviderName  Chocolatey ruby
Install-Package -ProviderName Chocolatey ruby
function updateSubmodulesRecursevly(repository, cloneOptions) {
return repository.getSubmoduleNames().then(function(names) {
return names.reduce(function(promiseChain, name) {
return promiseChain.then(function() {
return new Promise(function(resolve, reject) {
Submodule.lookup(repository, name)
.then(function(submodule) {
return submodule.init(1)
.then(function(result) {
return submodule.update(1, cloneOptions)
const request = require('request');
module.exports = {
describe_if_reachable: function(targetUrl, name, testDescription) {
request(targetUrl, {}, function(err, res, body) {
if (err) {
describe.skip(name, testDescription);
} else {
describe(name, testDescription);
}
initial = [{ code: "1", size: 0 }, { code: "2", size: 0 }, { code: "3", size: 0 }, { code: "4", size: 0 }]
update = [{ code: "1", size: 100 }, { code: "2", size: 100 }, { code: "2", size: 120 }]
hash = {}
for (let i = 0; i < initial.length; i++) {
let o = initial[i];
hash[o.code] = { code: o.code, size: 0 };
}
---
platform:
- name: win10
builders:
- name: qt-win-app-5.6
params:
dir: C:/opt/Qt5.6
version: 5.6
steps:
- prepare
version: '3.1'
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: example
dump-restorer:
image: postgres

How to set sudo password of VM deployed with BOSH v2

BOSH uses crypt(3) to encrypt sudo passwords. You can find an example of how it is done in sha512_hashed_password function.

This function is called in a case when you didn't set password in vm_type section (using env.bosh.password) of Cloud Config and set director.generate_vm_passwords property.

gem install 'unix-crypt'
PASS=c1oudc0w
ruby -e "require 'unix_crypt'; require 'securerandom'; salt = SecureRandom.hex(8); puts UnixCrypt::SHA512.build('$PASS', salt);"
@allomov
allomov / app.go
Created May 17, 2017 17:22
Golang Hello World Application on Cloud Foundry
package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, Cloud Foundry!\n")
#!/usr/bin/env bash
project_dir=$(cd `dirname $0` && cd .. && pwd)
if [ ! -d "$project_dir/uaa-release" ]; then
echo "Please, clone uaa-release repos to the project folder."
exit 1
fi
if [ ! -f "$project_dir/ldap-manifest.yml" ]; then