Skip to content

Instantly share code, notes, and snippets.

View milosjanda's full-sized avatar

Miloš Janda milosjanda

  • Livesport s.r.o.
  • Prague, Czech Republic
  • X @milosjanda
View GitHub Profile
#!/bin/bash
# Switching two different SSH identities
# Solve setting of remote url in every repository like https://docs.gitlab.com/ee/ssh/#multiple-accounts-on-a-single-gitlab-instance
#
# 1. Create directory structure:
# ~/.ssh-work
# ├── home
# │ ├── .home # important!
# │ ├── config
@milosjanda
milosjanda / .gitconfig
Last active August 26, 2020 13:45
Git aliases
[alias]
br = branch
brd = branch -d
brD = branch -D
# brp = "!git branch --merged | grep -v '\\*\\|development' | xargs -n 1 git branch -d"
brp = !git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D
brv = !git -P branch -va
bru = !git fetch && git reset origin/$(git branch --show-current) --hard
ci = commit
co = checkout
@milosjanda
milosjanda / redis-delete-keys.sh
Created June 15, 2017 08:33
CLI command to delete keys with pattern
redis-cli --scan --pattern 'myKeyToSearch*' | xargs redis-cli del
@milosjanda
milosjanda / redis-check-ttl.sh
Created June 15, 2017 08:28
Script to get KEYS and theirs TTL
#!/usr/bin/env bash
start=$(date +%s.%N)
# how many keys get in one time
COUNT=10000
# count of loops
LOOP=$(seq 0 1 10)
#!/usr/bin/env bash
# 1. install `composer require nextras/migrations`
# 2. install favorite DBAL (Dibi | Nextras\Dbal | Doctrine\Dbal | Nette\Database), if still not exists in project
# 3. in application root run this script (which create basic directory sctructure and template for run.php script)
# 4. modify file ${DIRECTORY}/run.php with respect your adapter + read DB config setting from yout project
# 5. to file ${DIRECTORY}/structures/${DATE}-initDatabase.sql insert actual create scritp of your DB without data
# 6. eventually to file ${DIRECTORY}/basic-data/${DATE}-initData.sql add basic data (for exmple any enumeration)
# 7. run `/usr/bin/php -f ${DIRECTORY}/run.php structures production-data --init-sql`
# 8. output SQL script run on your database