Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
allomov:~/Downloads/onliner_analyzer → touch .ruby-version
allomov:~/Downloads/onliner_analyzer → touch .ruby-gemset
allomov:~/Downloads/onliner_analyzer → subl .
allomov:~/Downloads/onliner_analyzer → rvm list
rvm rubies
jruby-9.1.13.0 [ x86_64 ]
ruby-2.1.5 [ x86_64 ]
ruby-2.3.0 [ x86_64 ]
import java.math.*;
public class Operation {
double[] operatorsValues;
void setOperatorsValues(double[] values) { operatorsValues = values; }
String[] getOperationNames() {
return String[]{this.getFirstOperationName(), this.getSecondOperationName()}
}

Find the service by name

tasklist | Select-String -Pattern "Dev*"
Find-Package -ProviderName  Chocolatey ruby
Install-Package -ProviderName Chocolatey ruby
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
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")