Skip to content

Instantly share code, notes, and snippets.

View asalimonov's full-sized avatar

Alexander Salimonov asalimonov

View GitHub Profile
@asalimonov
asalimonov / main.tf
Created July 8, 2020 17:14
Terraform random passwords
provider "random" {
version = "2.2.0"
}
variable "users" {
type = set(string)
default = ["alice", "bob"]
}
resource "random_password" "pwd" {
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# Sort a list of dictionary objects by a key - case sensitive
from operator import itemgetter
mylist = sorted(mylist, key=itemgetter('name'))
# Sort a list of dictionary objects by a key - case insensitive
mylist = sorted(mylist, key=lambda k: k['name'].lower())
@asalimonov
asalimonov / checkout-pr.md
Created March 26, 2019 11:57 — forked from orjan/checkout-pr.md
Checkout pull request in Bitbucket server

Checking out pull requests in Bitbucket

/.git/config
[remote "origin"]
    url = ssh://[email protected]:7999/brikks/brikks.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
    fetch = +refs/pull-requests/*/merge:refs/remotes/origin/pull-requests-merge/*
@asalimonov
asalimonov / gist:72554a2cb829b69dd2bc76e52db703ff
Created November 16, 2018 10:16
Configs for MySQL 5.7 (source DB) and AWS Data Migration service
#MySQL 5.7 has a bug in the engine. The MySQL as a source where it sends incorrect message to DMS task about the number of rows in a table. This will lead to not all data being loaded to the target database.
#Extra connection attributes for AWS DMS task
Resumefetchforxrows=0;unloadTimeout=36000
#Parameters for the source MySQL instance to increase the read and write timeout periods
net_read_timeout: 3600
net_write_timeout: 3600
wait_timeout: 86400
max_allowed_packet: 16777216
@asalimonov
asalimonov / bash_cmd_connectors.txt
Created November 7, 2018 10:23
Bash command connectors
A; B # Run A and then B, regardless of success of A
A && B # Run B if and only if A succeeded
A || B # Run B if and only if A failed
A & # Run A in background.
@asalimonov
asalimonov / cmds.txt
Last active October 30, 2018 08:53
MySQL in Docker Container
#remove mysql images
docker image ls | grep mysql | cut -f 1 -d ' ' | xargs docker image rm -f
#setup docker container
docker run --name mysql0 -p 0.0.0.0:3306:3306 -p 0.0.0.0:33060:33060 -td mysql/mysql-server:8.0
#get generated password
docker logs mysql0 2>&1 | grep GENERATED
#update root's password
@asalimonov
asalimonov / README.md
Created July 5, 2018 17:10 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

OP: @leonardofed founder @ plainflow.