Skip to content

Instantly share code, notes, and snippets.

Petr Michalec epcim

Block or report user

Report or block epcim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@epcim
epcim / hab clustered etcd
Created Sep 16, 2019
etcd habitat docker-compose hab
View hab clustered etcd
# See more: https://gist.github.com/epcim/80d2dda18e2b3022e4ab07f161f59823
# hab clustered etcd
## compose
cat <<EOF > docker-compose.yml
version: '3'
services:
etcd1:
@epcim
epcim / wait_for_http_200.sh
Created Aug 26, 2019 — forked from rgl/wait_for_http_200.sh
Wait for an HTTP endpoint to return 200 OK with Bash and curl
View wait_for_http_200.sh
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@epcim
epcim / needle.sh
Last active Jun 18, 2019
split needle csplit
View needle.sh
# example usage: to split yaml with multiple documents
needle() {
SUFFIX=${1##*.}
NEEDLE=${2:----}
csplit -b "%03d.$SUFFIX" -zsf $(basename $1 .$SUFFIX) $1 /$NEEDLE/+1 {*}
}
needle vega-objects.yaml
View gitlab-get-project.py
#!/bin/env python3
import gitlab
import sys
# private token or personal token authentication
gl = gitlab.Gitlab('https://gitlab.com/', private_token='******')
if len(sys.argv) > 1:
if sys.argv[1].find("/") > 0:
@epcim
epcim / habitat_systemd.md
Last active Sep 16, 2019
hab habitat hab-sup deployment etcd
View habitat_systemd.md

Simple deployment script to install habitat container with the app as systemd service.

export ALT=500 # Prefix for all the service names/ports used (apply to habitat/ inner service service)
# cleanup
systemctl stop etcd-$ALT
sleep 3
rm -f /etc/systemd/system/etcd-$ALT.service /etc/default/etcd-$ALT*
rm -rf /srv/etcd-$ALT
@epcim
epcim / debian-live.sh
Created May 13, 2019
debian livecd netboot
View debian-live.sh
# Create a Custom Debian Live Environment (CD or USB)
https://willhaley.com/blog/custom-debian-live-environment/
View update from line
# rewrite part of the file from variable
sed -i "/^write_files:/{
s/write_files://g
r $NET_RULES
}" $CLOUD_CONFIG_FILE
View gitlab-issues.md
@epcim
epcim / get-pods.sh
Last active Apr 29, 2019
kubectl kubernetes alias bash cli
View get-pods.sh
# you can't live without 'k' and 'p'
# kubectl alias
alias k='kubectl'
# kubectl get pods alias
## store Kubernetes pod name & namespace to env variable
## expect servername has number behind last -
[[ -z $ZSH_NAME ]] || setopt SH_WORD_SPLIT
function get-pods() {
View osx_gnu_shell_experience.sh
# keep you $SHELL as osx bash
# modify your term/iterm2/kitty to start your preffered shell (I do zsh, you can start "up to date" bash from `brew`)
# gnu cmd links without "g" preffixed
mkdir ~/bin-osxoverride
for i in $(ls /usr/local/bin/g*) ;do N=$(basename ${i/g//}); ln -sf $i ~/bin-osxoverride/$N; done
# update your path
echo "export PATH=~/bin-osxoverride:$PATH" >> ~/.zshrc
You can’t perform that action at this time.