Skip to content

Instantly share code, notes, and snippets.

View p0vidl0's full-sized avatar
💭
🖥️ Working 💻

Alexander p0vidl0

💭
🖥️ Working 💻
View GitHub Profile
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
  • Centralized locking can be based on this K/V store.
@p0vidl0
p0vidl0 / kubectl-cheat-sheet.md
Last active August 25, 2021 04:00
Kubectl cheat sheet

Import cluster to kubeconfig

aws eks --region us-west-2 update-kubeconfig --name CLUSTER_NAME

Show current kubectl context

kubectl config current-context

Rename kubectl context

kubectl config rename-context CURRENT_NAME NEW_NAME

Show all kubectl contexts

@p0vidl0
p0vidl0 / .00.README.md
Last active October 22, 2020 02:13
Dev dependencies for Node.js with Typescript, ESLint and Prettier

Dev dependencies for Node.js with Typescript, ESLint and Prettier

Copy attached files to a blank project root directory and run commands:

npm init
bash ./install-dev-dependencies.sh
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 &&
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list &&
apt install apt-transport-https &&
apt update &&
apt install mongodb-org-shell -y
# Run gitlab runner inside docker container
docker run -d --name gitlab-runner --restart always --privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:v10.3.0
# Register shell runner
sudo gitlab-runner register \
-non-interactive \
--executor "shell" \
--url $GITLAB_URI \
apt-get update &&
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common &&
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - &&
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
@p0vidl0
p0vidl0 / drop_duplicates.sql
Last active July 26, 2021 11:48
Delete all duplicate rows based on the email field
DELETE c1 FROM `clients` c1, `clients` c2 WHERE c1.`id` < c2.`id` AND c1.`email` = c2.`email`;
@p0vidl0
p0vidl0 / run_kafka_in_docker.sh
Created July 16, 2018 05:00
Run kafka in docker
git clone https://github.com/wurstmeister/kafka-docker . && docker-compose up
docker run -it --rm -p 9000:9000 -e ZK_HOSTS="my.zookeeper.host.com:2181" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager
@p0vidl0
p0vidl0 / zabbix_cleanup.sql
Last active September 22, 2018 03:15 — forked from edtjones/zabbix_cleanup.sql
Clean up zabbix database
SET @history_interval = 3;
SET @trends_interval = 90;
DELETE FROM alerts WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
ALTER TABLE alerts ENGINE=INNODB;
DELETE FROM acknowledges WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
ALTER TABLE acknowledges ENGINE=INNODB;
DELETE FROM events WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
ALTER TABLE events ENGINE=INNODB;