Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
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"
var {Checkout, Submodule, Repository} = require("nodegit");
Repository.open("/native-repo")
.then(function(repository) {
return repository.getTagByName("v1.0.8")
.then(function(result) { console.dir(result); return result; })
.then(function(tag) { console.dir([tag.targetId(), repository.defaultSignature, "Checkout: HEAD " + tag.targetId()]); return tag; })
.then(function(tag) { repository.setHeadDetached(tag.targetId(), repository.defaultSignature, "Checkout: HEAD " + tag.targetId()) })
})
.then(function() { console.log("done");})
.done()
require 'open-uri'
doc = Nokogiri::HTML(URI.open("https://www.oscars.org/oscars/ceremonies/2022"))
doc.css(".view-grouping-header h2")
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)
@allomov
allomov / custom-http-request-php-example.php
Last active February 17, 2020 14:11
Создание звонка через Custom HTTPS интеграцию с помощью PHP. YOUR_AUTHORIZATION_TOKEN и YOUR_INTEGRATION_URL берется из DealApp приложения https://www.notion.so/dealapp/Custom-HTTPS-v1-5288b1eebcc84188a383bd59755a0f40
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "YOUR_INTEGRATION_URL",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "activerecord", require: "active_record"
gem "activejob", require: "active_job"
gem "sqlite3"
gem "searchkick", git: "https://github.com/ankane/searchkick.git"
end
@allomov
allomov / get-request.sh
Last active January 15, 2019 20:39
An example that demonstrates a simple app with Sinatra, html templates and jQuery.
curl -X GET http://localhost:4567
Xcloud@xcloud199 ~> cat /Library/LaunchDaemons/monit.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>monit</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/monit</string>
var url = 'http://localhost:8081/api/v2/deliverable_builds/6db57828-01b5-11e8-a40f-685b358e6aa5'
var idExtractor = /([\d\w\-]+)$/g;
var idMatch = idExtractor.exec(url);
console.log(idMatch[1]);
var typeExtractor = /\/([\w\d\_]+)\/[\d\w\-]+$/g;
var typeMatch = typeExtractor.exec(url);
console.log(typeMatch[1]);
@allomov
allomov / generate-students-fixture.rb
Last active July 29, 2018 19:53
rubizza-camp rails introduction
require "faker"
puts (1..13).map { |i| {name: Faker::RickAndMorty.character, bio: Faker::RickAndMorty.quote, number: rand(1000..9999), is_alive: [true, false].sample} }.reduce({}) {|res, obj| res[obj[:name]] = obj; res }.to_yaml