Skip to content

Instantly share code, notes, and snippets.

View BertiKarsunke's full-sized avatar

Yi Seong Zin BertiKarsunke

  • Seoul
View GitHub Profile
@BertiKarsunke
BertiKarsunke / retrieve_fastlane_session.rb
Created January 3, 2022 05:35 — forked from gaelfoppolo/retrieve_fastlane_session.rb
Auto-setting FASTLANE_SESSION on CI
lane :retrieve_fastlane_session do
# runs shell
# this needs SPACESHIP_SKIP_2FA_UPGRADE=1 flag
spaceauth_output = `bundle exec fastlane spaceauth`
# regex the output for the value we need
fastlane_session_regex = %r{Pass the following via the FASTLANE_SESSION environment variable:\n(?<session>.+)\n\n\nExample:\n.+}
new_session = nil
if match = spaceauth_output.match(fastlane_session_regex)
# strip out the fancy formatting
@BertiKarsunke
BertiKarsunke / slack-push-logs.sh
Created March 18, 2019 02:49 — forked from replsv/slack-push-logs.sh
Slack log file watcher
#!/bin/bash
SLACK_HOOK_URL="https://hooks.slack.com/services/SOME/SPECIAL/TOKEN"
SLACK_CHANNEL="#production-logs"
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE") && curl -X POST --silent --data-urlencode \
"payload={\"channel\": \"$SLACK_CHANNEL\", \"mrkdwn\": true, \"text\": \"$(echo $LINE | sed "s/\"/'/g") | File: ${1} | Server: $(hostname)\"}" $SLACK_HOOK_URL;
done
@BertiKarsunke
BertiKarsunke / puppeteer-click-by-text.js
Created March 18, 2019 01:28 — forked from tokland/puppeteer-click-by-text.js
Click link by text in Puppeteer
const puppeteer = require('puppeteer');
const escapeXpathString = str => {
const splitedQuotes = str.replace(/'/g, `', "'", '`);
return `concat('${splitedQuotes}', '')`;
};
const clickByText = async (page, text) => {
const escapedText = escapeXpathString(text);
const linkHandlers = await page.$x(`//a[contains(text(), ${escapedText})]`);