Skip to content

Instantly share code, notes, and snippets.

View voyager123bg's full-sized avatar

Nikolay Georgiev voyager123bg

View GitHub Profile
@voyager123bg
voyager123bg / Jenkinsfile.groovy
Created June 18, 2021 09:06 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@voyager123bg
voyager123bg / helm-cheatsheet.md
Created June 4, 2021 11:49 — forked from tuannvm/cka.md
#Helm #Kubernetes #cheatsheet, happy helming!
@voyager123bg
voyager123bg / daemonset.yaml
Created May 14, 2021 09:41 — forked from omerlh/daemonset.yaml
A daemonset that print the most heavy files on each node
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: disk-checker
labels:
app: disk-checker
spec:
selector:
matchLabels:
app: disk-checker
@voyager123bg
voyager123bg / README.md
Created March 15, 2021 09:52 — forked from twolfson/README.md
Setting up SOPS

I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.

PGP

It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)

This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.

Web of trust

Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.

This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.

@voyager123bg
voyager123bg / gist:e46cdd50bf130022585154650988e678
Created November 16, 2020 14:41
recursively replace string in file structure with sed
# Replace all occurances of search with replace
egrep -lRZ 'search' .|xargs -0 -l sed -i -e 's/search/replace/'
@voyager123bg
voyager123bg / hostnames.yml
Created October 4, 2018 17:54
ansible host file generator - add private ip for inventory hosts
- name: "Build hosts file"
lineinfile:
path: /etc/hosts
regexp: '.*{{ item }}$'
line: "{{ hostvars[item]['ansible_default_ipv4']['address'] }} {{ item }}"
state: present
with_items:
- "{{ groups['mongo-config'] }}"
- "{{ groups['mongo-shards'] }}"
- "{{ groups['mongo-main'] }}"
@voyager123bg
voyager123bg / rundeck-read-run-only.aclpolicy
Created March 7, 2018 08:59 — forked from kjhosein/rundeck-read-run-only.aclpolicy
A Rundeck ACL policy file that allows users in a specific group to run jobs, view nodes, view activity logs, run adhoc jobs in a specific project.
---
description: "Allow users in runjobs group to run, kill jobs, etc. in the project called specific-project-name"
# They can also read the activity logs and view the nodes.
context:
project: specific-project-name
by:
group: runjobs
for:
resource:
- equals:
@voyager123bg
voyager123bg / Ghost - Demonize anything
Last active March 2, 2018 14:41 — forked from Radamanf/Ghost - Demonize anything
This is an initialization script "/etc/init.d/ghost" file which helps you to start, stop, status executable or java -jar file.jar with nohup and & - background option, this is pretend way make a daemon, but maybe will be interested to someone. It uses PID file and checks if the process is running before every start or stop.Once it's configured y…
# Licence: GPLv3, MIT, BSD, Apache or whatever you prefer; FREE to use, modify, copy, no obligations
# Description: Bash Script to Start the process with NOHUP and & - in background, pretend to be a Daemon
# Author: Andrew Bikadorov
# Script v1.5
# Slightly altered, Author: Nikolay Georgiev.
if [ -z "$2" ]; then
echo "You must specify microservice-name to use this script!"
exit 1
fi