Skip to content

Instantly share code, notes, and snippets.

View alexanderlz's full-sized avatar

Alexander Leibzon alexanderlz

View GitHub Profile
@mac2000
mac2000 / postgres_master_slave_failover_failback.md
Last active June 28, 2024 08:23
Postgres Master Slave Failover & Failback

Postgres Master Slave Failover & Failback

video

start

docker run -it --rm -p 5551:5432 --name=db1 --hostname=db1 ubuntu:20.04 bash
docker run -it --rm -p 5552:5432 --name=db2 --hostname=db2 ubuntu:20.04 bash
@Shaboodi
Shaboodi / kafka-cheat-sheet.md
Created October 18, 2018 07:28 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@dvirsky
dvirsky / redis-bashcomplete
Last active July 20, 2017 00:47
Bash completion for redis server and cli
# bash completion for redis-cli and redis-server
have redis-server &&
_redisserver()
{
local cur prev split=false
COMPREPLY=()
_get_comp_words_by_ref cur prev
@arikfr
arikfr / README.md
Last active August 26, 2024 19:27
Redash Query Export Tool

Setup

$ pip install click requests

Usage

$ python query_export.py --redash-url "https://app.redash.io/" --api-key ""
@pulkitsinghal
pulkitsinghal / ReindexData.java
Last active March 12, 2018 10:38
Reindex data from one elasticsearch index to another
import io.searchbox.Action;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestClientFactory;
import io.searchbox.client.JestResult;
import io.searchbox.client.config.ClientConfig;
import io.searchbox.core.Bulk;
import io.searchbox.core.Bulk.Builder;
import io.searchbox.core.Index;
import io.searchbox.core.Search;
import io.searchbox.core.SearchScroll;
@ihorvorotnov
ihorvorotnov / get-social-shares
Last active May 26, 2024 08:13
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
@whittlec
whittlec / gist:6112643
Last active April 25, 2024 20:56
Install plugins to Jenkins via script console
for (plugin in ["ant",
"artifactdeployer",
"build-failure-analyzer",
"build-name-setter",
"build-pipeline-plugin",
"build-timeout",
"claim",
"clone-workspace-scm",
"cobertura",
"collapsing-console-sections",
@cenkalti
cenkalti / jenkins-home-git.sh
Last active September 8, 2023 17:19
Backup Jenkins home periodicallly with git.
#!/bin/bash
# Setup
#
# - Create a new Jenkins Job
# - Mark "None" for Source Control Management
# - Select the "Build Periodically" build trigger
# - configure to run as frequently as you like
# - Add a new "Execute Shell" build step
# - Paste the contents of this file as the command
@tovbinm
tovbinm / Pretty git log
Last active December 18, 2019 07:10
Pretty git log command
1.
Paste it to the bash:
git config --global alias.lg "log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)%an <%ae>%Creset' --abbrev-commit"
2.
Then in any git repo type: git lg
3.
Enjoy