Skip to content

Instantly share code, notes, and snippets.

View OlegGorj's full-sized avatar
🎯
Focusing

oleggorj OlegGorj

🎯
Focusing
View GitHub Profile
apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
name: ingressgateway
namespace: istio-system
spec:
targets:
- name: istio-ingressgateway
peers:
- mtls: {}
@OlegGorj
OlegGorj / git_helper.sh
Created September 24, 2019 19:41
commit code changes to GitHub for all storefront projects
#!/bin/bash
# commit code changes to GitHub for all storefront projects
# usage: sh ./git_helper.sh "Refactoring storefront code"
args=("$@")
root="/Users/garystafford/Documents/projects"
repos=(
storefront-demo-accounts
@OlegGorj
OlegGorj / ssh-github-deploy.sh
Created September 23, 2019 14:08
Programmatically create deploy keys, on server and GitHub, for an existing git repository
#!/bin/sh
KEYDIR=~/.ssh/keys.d/github-deploy
CONFDIR=~/.ssh/config.d/github-deploy
github_username=noah
github_access_token=$(cat ~/.secret/github_access_token)
rp=$(git rev-parse --is-inside-work-tree 2>/dev/null)
@OlegGorj
OlegGorj / loop through json.md
Created September 22, 2019 19:52
looping through JSON array in shell script

Assume we have following json:

{
  "path": {
    "components": [],
    "name": "",
    "toString": ""
  },
  "revision": "master",
@OlegGorj
OlegGorj / progress bar.md
Created September 22, 2019 19:48
progress bar in a shell script

You can implement this by overwriting a line. Use \r to go back to the beginning of the line without writing \n to the terminal.

Write \n when you're done to advance the line.

Use echo -ne to:

  • not print \n and
  • to recognize escape sequences like \r
@OlegGorj
OlegGorj / Spinner.md
Created September 22, 2019 19:47
Spinner Animation and echo command
#!/bin/bash

## spinner takes the pid of the process as the first argument and
#  string to display as second argument (default provided) and spins
#  until the process completes.
spinner() {
    local PROC="$1"
    local str="${2:-'Copyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆'}"
 local delay="0.1"
@OlegGorj
OlegGorj / trim.md
Created September 22, 2019 19:45
trim whitespace from a Bash variable

Let's define a variable containing leading, trailing, and intermediate whitespace:

FOO=' test test test '
echo -e "FOO='${FOO}'"
# > FOO=' test test test '
echo -e "length(FOO)==${#FOO}"
# > length(FOO)==16
@OlegGorj
OlegGorj / Using Github Deploy Key.md
Created September 21, 2019 19:07 — forked from zhujunsan/Using Github Deploy Key.md
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@OlegGorj
OlegGorj / Jenkinsfile
Created February 22, 2019 00:02 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
PostgreSQL has Foreign Data Wrappers. A very powerful feature. Greenplum
has External Tables. Also a very powerful feature. In fact, it's pretty
much the same feature. As we catch up with PostgreSQL, we need to figure
out what we're going to do about that. In the long run, we clearly don't
want to maintain two features that do the same thing, but with different
syntax and different set of wrappers/plugins.
Goal
----