Skip to content

Instantly share code, notes, and snippets.

View cvakiitho's full-sized avatar
🌈
Focusing

Tomáš Hartmann cvakiitho

🌈
Focusing
View GitHub Profile
@cvakiitho
cvakiitho / Protractor.js
Last active September 10, 2015 12:42
useful snippets for protractor
//when you expect error on some command:
element.click().then(function(){
console.log('shouldn`t get here raise error:');
expect(1).toBe(0);
},function(err){
console.log('expected error, as element should not receive click');
});
//Expecting some URL change:
@cvakiitho
cvakiitho / gist:7167ff3098d7f28e90c2e79d653eda6f
Last active July 26, 2016 14:09
Git extract directory 1 from repo A to repo B - including history only from that dir
git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
// now you can move it to another dir if you need to - so it is in same structure as repo B
git clone <git repository B url>
cd <git repository B directory>
git remote add repo-A-branch <git repository A directory>
from selenium import webdriver
driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities=webdriver.DesiredCapabilities.FIREFOX
)
# driver = webdriver.Firefox()
driver.get("https://sapui5.hana.ondemand.com/#docs/guide/95d113be50ae40d5b0b562b84d715227.html")
@cvakiitho
cvakiitho / docker-ce-rhel.sh
Last active November 2, 2017 10:22
get-docker without rhel check
#!/bin/sh
set -e
# This script is meant for quick & easy install via:
# $ curl -fsSL get.docker.com -o get-docker.sh
# $ sh get-docker.sh
#
# For test builds (ie. release candidates):
# $ curl -fsSL test.docker.com -o test-docker.sh
# $ sh test-docker.sh
map "o" newTab
@cvakiitho
cvakiitho / uiveri5APICheatsheet.md
Last active August 20, 2021 00:53 — forked from javierarques/protractorAPICheatsheet.md
UIVeri5 API Cheatsheet

UIVeri5 API cheatsheet

it uses protractor beneath, so this is a good resource: http://angular.github.io/protractor/#/api

Notes:

  • Most commands return promises, so you only resolve their values through using jasmine expect API or using .then(function()) structure.

  • Promises are resolved by WebdriverJS promise manager . If you want to schedule non-api made promise into the chain, you have to use one of:

@cvakiitho
cvakiitho / github.js
Created March 15, 2021 17:10
Github Graphql branch protection rule
const fetch = require('node-fetch');
let url = 'https://<>.corp/api/graphql';
let options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic <base64 token>'
},
println "\nfunctions\n***********"
println this.steps.functions.collect { k,v -> v.getFunctionName()}
println "\nstepClassNames\n***********"
println this.steps.stepClassNames.collect { k,v -> v.getFunctionName()}
println "\nunreportedAmbiguousFunctions\n***********"
println this.steps.unreportedAmbiguousFunctions.collect { k,v -> v.getFunctionName() }
println "\nallGlobalVariables\n***********"
@cvakiitho
cvakiitho / script.groovy
Created May 25, 2021 13:58
Jenkins trigger all branch jobs in organization
// https://javadoc.jenkins.io/jenkins/model/Jenkins.html#getItemByFullName-java.lang.String-
def organization = Hudson.instance.getItemByFullName('S4-FIORI-CORE-1 GitHub Quality')
if (!organization) throw new Exception("No organization by that name")
// https://javadoc.jenkins.io/plugin/cloudbees-folder/com/cloudbees/hudson/plugins/folder/AbstractFolder.html#getItems--
def jobs = organization.getItems()
jobs.each {
// find the sub-job that's named "master"
// https://javadoc.jenkins.io/hudson/model/Item.html#getName--
main = it.items.find { it.getName() == "main" }
// if found, schedule a build with 0 quiet period
@cvakiitho
cvakiitho / script-approval.groovy
Created June 10, 2021 12:25
Script to get hash from groovy script for script-approval
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
class Scratch {
public static void main(String[] args) {
String language = "groovy";
String script ='''
'''