Skip to content

Instantly share code, notes, and snippets.

View DzeryCZ's full-sized avatar
🎸

Jaroslav Živný DzeryCZ

🎸
  • ErsteBank
  • Vienna
View GitHub Profile
@DzeryCZ
DzeryCZ / Run (.exe) WSL Without Extension
Created April 13, 2018 21:17
Run Windows Programs (.exe) from WSL as Fallback without extension
# Add at the end of your ~/.bashrc file this content:
# Run Windows Programs (.exe) from WSL as Fallback without extension
eval "$(echo "orig_command_not_found_handle()"; declare -f command_not_found_handle | tail -n +2)"
command_not_found_handle()
{
cmd=$1
shift
args=( "$@" )
@DzeryCZ
DzeryCZ / cleanDocker.sh
Last active December 17, 2018 14:17
Clean Docker Containers and Images
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Delete all volumes
docker volume rm $(docker volume -q)
@DzeryCZ
DzeryCZ / docker-machine-wsl.md
Last active December 9, 2018 22:40
Make docker-machine works properly on WSL

docker-machine Doesn't work properly inside of WSL, this function makes it work.

Add this to ~/.bashrc:

function docker-machine()
{
    if [ $1 == "env" ]; then
            docker-machine.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's/"//g'
    else

docker-machine.exe "$@"

@DzeryCZ
DzeryCZ / Mount drives.md
Last active June 18, 2018 20:34
Bind custom mount points to fix Docker for Windows and WSL difference

In Windows 10 version >= 1803

Edit/Create /etc/wsl.conf and add this content:

[automount]
root = /
options = "metadata"
@DzeryCZ
DzeryCZ / Set tab title in Hyper.md
Last active May 4, 2018 15:54
Set tab title in Hyper

Add this to ~/.bashrc

# Setting Title in Hyper
function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }

Log out and back in the terminal

Use as

@DzeryCZ
DzeryCZ / Show GIT branch.md
Created June 26, 2018 15:08
Linux bash - Show Git branch

Add to your ~/.bashrc file

parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[36m\]\u@\h\[\033[00m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@DzeryCZ
DzeryCZ / DateTimeHandler.php
Created August 6, 2018 16:12
Symfony + FOS Rest + JMS serializer - Serialization handler
<?php
declare(strict_types=1);
namespace MyApp\Infrastructure\Handler;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\JsonSerializationVisitor;
use JMS\Serializer\Context;
@DzeryCZ
DzeryCZ / YubikeyOnWindows.md
Created September 14, 2018 09:06
How to use YubiKey On Windows

How to make GPG agent restart with every connection of YubiKey:

GPG agent sometimes stuck when you put your PC to sleep mode or when you unplug and plug your YubiKey back. This Solution will restart the GPG agent with every connection of YubiKey.

  • Create a "yubi-reset.bat" file on your disk and put there this content:
gpg-connect-agent killagent /bye
gpg-connect-agent /bye
  • Open Event Viewer
@DzeryCZ
DzeryCZ / Minikube_WSL.md
Last active December 9, 2018 22:40
Minikube in WSL

Minikube in WSL

  1. Install minikube in windows
  2. Add this to ~/.bashrc:
function minikube()
{
    if [ $1 == "docker-env" ]; then
 minikube.exe $1 $2 --shell bash | sed 's/C:/\/c/' | sed 's/\\/\//g' | sed 's/"//g'
@DzeryCZ
DzeryCZ / ReadingHelmResources.md
Last active April 22, 2024 16:09
Decoding Helm3 resources in secrets

Helm 3 is storing description of it's releases in secrets. You can simply find them via

$ kubectl get secrets
NAME                                                TYPE                                  DATA   AGE
sh.helm.release.v1.wordpress.v1                     helm.sh/release.v1                    1      1h

If you want to get more info about the secret, you can try to describe the secret

$ kubectl describe secret sh.helm.release.v1.wordpress.v1