This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { spawnSync } from 'child_process' | |
import { writeFileSync, rmSync } from 'fs' | |
const tempTsConfig = './lint-staged-tsconfig.json' | |
const main = () => { | |
const files = process.argv.slice(2) | |
writeFileSync( | |
tempTsConfig, | |
JSON.stringify({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### in local ### | |
# gen private key | |
openssl genrsa -aes128 -out private.pem 4096 | |
# gen public key from private key | |
openssl rsa -in private.pem -pubout > public.pem | |
### in CI ### | |
# setup the $PUB secret in the CI platform settings, create public key in CI steps | |
echo "$PUB" > public.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list ingress host and paths, ref https://www.kaper.com/cloud/find-kubernetes-ingress-rules/ | |
kubectl get ingress -o json | \ | |
jq -r '.items[] | . as $parent | .spec.rules[] | select(.host=="HOST.NAME.YOU.WANT") | .host as $host | .http.paths[] | ( $host + " " + .path + " " + .backend.service.name + " " + $parent.metadata.name )' | \ | |
sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cur_branch=$(git branch --show-current) | |
git stash | |
git checkout $1 | |
git pull | |
git checkout $cur_branch | |
git rebase --onto $1 $2 | |
git stash pop stash@\{0\} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remote_pruned_branches=$(git remote prune origin | tail -n +3 | sed -e 's| \* \[pruned\] origin/||') | |
echo "remote pruned branches:\n$remote_pruned_branches" | |
echo "\ndeleting branches:" | |
echo $remote_pruned_branches | xargs git branch -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sourceMap = require("source-map"); | |
const fetch = require('node-fetch'); | |
const sourcemapUrl = 'https://example.com/9fb743af.chunk.js.map'; | |
const targetLine = 6; | |
const targetColumn = 9497; | |
fetch(sourcemapUrl) | |
.then(body => body.text()) | |
.then(map => new sourceMap.SourceMapConsumer(map)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import PropTypes from 'prop-types' | |
const GOOGLE_AD_MANAGER_ID = 'YOUR_ID' | |
/** | |
* It's used to generate ad element id. Make sure: | |
* - only increment it ONCE per component | |
* - only modify it on browser, not on server side | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>React Recaptcha Example</title> | |
</head> | |
<body> | |
<script> | |
function onRecaptchaLoaded() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urlparse | |
def merge_query_to_url(url, query): | |
"""Merge query into url without any url encode/decode.""" | |
url_parts = urlparse.urlparse(url) | |
# convert existing query string to dict | |
# | |
# Not using `urlparse.parse_qs` to extract existing query from url because | |
# it will convert url's query to utf8 string if it's url encoded |