## Add a new key to the existing configmap
$ kubectl patch cm demo-app-config --type json --patch '[{ "op": "add", "path": "/data/TEST_VALUE", "value": "test_key" }]'
configmap/demo-app-config patched
$ kubectl get cm demo-app-config -o json | jq .data.TEST_VALUE
"test_key"
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
#place the file in your ansible playbook director under filter_plugins | |
#/home/user/my_playbook.yml | |
#/home/user/filter_plugins/my_filters.py | |
#!/usr/bin/python | |
class FilterModule(object): | |
def filters(self): | |
return { | |
'a_filter': self.a_filter, | |
'another_filter': self.b_filter |
NOTE: Kafkacat is renamed to kcat recently and the config variable should be KCAT_CONFIG for version 1.7 onwards.
# you can export the variable or present the config with -F parameter for kafkacat
export KAFKACAT_CONFIG=/home/tools/persistent/kcat/kafkacat_config
There are 2 ways of consuming kafka messages from a given topic at a specific offset.
get_group_offset(){
# describe a given group and sort by partition
/home/tools/confluent/bin/kafka-consumer-groups --bootstrap-server ${KAFKA_BROKER} --command-config ${CONFIG} --timeout 15000 --group $1 --describe | sort -k2,3
}
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
#clone the repo | |
git clone http://git.ipxe.org/ipxe.git | |
cd ipxe/src | |
cat >ubuntu-amd64-installer.ipxe <<EOF | |
#!ipxe | |
dhcp | |
echo Starting Ubuntu x64 installer for ${hostname} | |
set base-url http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 | |
kernel ${base-url}/linux |
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
# generate a key if you don't have one already | |
gpg --full-gen-key | |
# list the keys in long format and copy the key id after sec rsa4096/<KEY> | |
gpg --list-secret-keys --keyid-format LONG | |
# export the public key and post into your git profile (ui) | |
gpg --armor --export 127CAA89CEA6BE66 | |
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
##create one big partition | |
echo ';' | sfdisk /dev/sdc | |
##create one big partition with specific partition type | |
#creates W95 FAT32 (LBA) | |
echo ',,c;' | sfdisk /dev/sdd | |
#creates lvm type | |
echo ',,8e;' | sfdisk /dev/sdd |
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
# Rotate client logs | |
# log file already has this context set. | |
# -rw-r-----. root root system_u:object_r:var_log_t:s0 /var/log/journald_splunk.log | |
# -rw-r-----. root root system_u:object_r:var_log_t:s0 /var/log/journald_splunk.log-2018020315 | |
/var/log/journald_splunk.log { | |
hourly | |
maxsize 3M | |
rotate 3 | |
missingok |
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
# good git book | |
http://git-scm.com/book | |
# Discard uncommitted changes in a specific file | |
git checkout file_name | |
# Clear everything not in repo | |
git checkout -- . | |
# A way to quickly move to the previous commit in a git branch. This also way for "deleting" last commit. |
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
#To Decrypt Jenkins Password from credentials.xml | |
#<username>jenkins</username> | |
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase> | |
#go to the jenkins url | |
http://jenkins-host/script | |
#In the console paste the script | |
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J' |