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 / update-ca-certificates.md
Last active Aug 2, 2019
trusted certificates system update-ca-certificates
View update-ca-certificates.md

Adding trusted root certificates to the server

Mac OS X

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-certificate.crt
sudo security delete-certificate -c "<name of existing certificate>"

Windows

certutil -addstore -f "ROOT" new-root-certificate.crt
@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 May 24, 2019
hab habitat hab-sup deployment
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 / docker-hub-search.sh
Created Mar 3, 2016
Search docker hub on CLI
View docker-hub-search.sh
#!/bin/bash
# http://stackoverflow.com/questions/24481564/how-can-i-find-docker-image-with-specific-tag-in-docker-registry-in-docker-comma
for Repo in $* ; do
tags=$(curl -s -S "https://registry.hub.docker.com/v2/repositories/library/$Repo/tags/")
python - <<EOF
import json
tags = [t['name'] for t in json.loads('''$tags''')['results']]
tags.sort()
@epcim
epcim / salt-trends.sh
Last active May 20, 2019
salt states trends jq yq
View salt-trends.sh
@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 db2-getcfg.howto.md

db2 query cfg

get dbm cfg show detail

db2 get snapshot for db on DAD
db2 get snapshot for bufferpools on DAD
db2 get snapshot for locks on DAD
db2 list active databases
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
You can’t perform that action at this time.