Skip to content

Instantly share code, notes, and snippets.

View daipresents's full-sized avatar

Dai Fujihara daipresents

View GitHub Profile
package main
import (
"fmt"
base64 "encoding/base64"
"os"
"strings"
"net/http"
"io/ioutil"
)
@daipresents
daipresents / gist:42699b98c26a54fc74f4d9aadf5ebf42
Created February 28, 2020 05:11
find TD and brother TD by Xpath
//table/tbody/tr/td[contains(text(), 'Dai FUJIHARA')]/following-sibling::td/div/[@class='button']
@daipresents
daipresents / ErrorLog
Last active August 27, 2023 18:19
Split Jenkinsfile
Running on master in /var/lib/jenkins/workspace/MY_JOB_NAME
[Pipeline] {
[Pipeline] pwd
[Pipeline] load
[Pipeline] // load
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.nio.file.NoSuchFileException: /var/lib/jenkins/workspace/MY_JOB_NAME/common.groovy
stage('build something'){
def build_info
try {
build_info = build job: build_something
currentBuild.result = "SUCCESS"
} catch {
println 'Job was failed.'
currentBuild.result = "FAILURE"
# frozen_string_literal: true
require 'pry'
require 'rspec/retry'
RSpec.configure do |config|
# rspec-retry
config.verbose_retry = true
config.display_try_failure_messages = true
@daipresents
daipresents / ExecutionLog
Last active July 13, 2019 12:42
Sample of Jenkinsfile for retry block.
Started by user daipresents
[Pipeline] node
Running on test-instance-1 in /var/jenkins/workspace/retry-sample
[Pipeline] {
[Pipeline] stage
[Pipeline] { (job 1)
[Pipeline] echo
job 1
[Pipeline] echo
default: currentBuild.result: null
$ arc
/Users/daipresents/.anyenv/envs/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok': An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: Command '/Users/daipresents/Library/Android/sdk/platform-tools/adb -P 5037 -s FA6950305822 install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-android-ime/bin/UnicodeIME-debug.apk' exited with code 1{"stdout":"","stderr":"Failed to install /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-android-ime/bin/UnicodeIME-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.android.ime without first uninstalling.]\n","code":1} (Selenium::WebDriver::Error::UnknownError)
from /Users/daipresents/.anyenv/envs/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sele
@daipresents
daipresents / rspec_raise_error
Last active March 28, 2017 06:22
expect { }.not_to raise_error(SpecificErrorClass)
WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect {}.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`.
@daipresents
daipresents / counter1
Created March 24, 2017 03:25
Postman example
var users = environment.users.split(',')
var counter = Number(environment.counter);
postman.setEnvironmentVariable("user", users[counter]);
@daipresents
daipresents / example1
Last active May 22, 2021 03:01
Ruby rest-client file upload as multipart
require 'rest-client'
RestClient.get(url, headers={})
RestClient.post(url, payload, headers={})