Skip to content

Instantly share code, notes, and snippets.

View hypnoglow's full-sized avatar
🔭
Stay curious

Igor Zibarev hypnoglow

🔭
Stay curious
View GitHub Profile
@hypnoglow
hypnoglow / aliases.sh
Created September 26, 2023 19:08
Bash Function to extract any archive. Add this to your .bashrc / .zshrc
ex() {
if [ -z "$1" ] ; then
echo >&2 'File not specified'
return 1
fi
if [ ! -f "$1" ] ; then
echo >&2 "'$1' is not a valid file"
return 1
fi
@hypnoglow
hypnoglow / README.md
Last active September 23, 2023 19:41
Bash script to generate secure random password

Usage:

  1. Save this script to gen-password.sh file

  2. Make it executable:

    chmod +x ./gen-password.sh
    
@hypnoglow
hypnoglow / docker-azurefile
Created November 16, 2016 16:20
This snippet installs azurefile volume plugin for docker.
#!/bin/bash
set -eufo pipefail
if [ -z "$1" ]; then
echo "Storage Account Name not set..."
exit 1
fi
if [ -z "$2" ]; then
@hypnoglow
hypnoglow / example.sh
Last active January 23, 2023 18:42
Bash trick to return string from function - 10x faster than using subshell like $(cmd)
function assign() {
unset -v "$1" || echo "Invalid identifier: $1" >&2
printf -v "$1" '%s' "$2"
}
function getHelloWorld() {
# Return the value "Hello World!"
local "$1" && assign "$1" "Hello World!"
}
@hypnoglow
hypnoglow / bootstrap
Last active December 30, 2016 10:08
Manjaro Bootstrap
#!/bin/bash
if [ -z "$1" ]; then
echo "Profile is not specified!"
exit 1
fi
sudo pacman -S --noconfirm git
git clone https://github.com/hypnoglow/manjaro-bootstrap ${HOME}/sources/hypnoglow/manjaro-bootstrap

Keybase proof

I hereby claim:

  • I am hypnoglow on github.
  • I am hypnoglow (https://keybase.io/hypnoglow) on keybase.
  • I have a public key whose fingerprint is C2ED FDB1 F233 75D4 A621 7AE3 52BF 1B92 D6CF 044B

To claim this, I am signing this object:

@hypnoglow
hypnoglow / dotbro.bash
Last active May 20, 2016 18:34
dotbro
#!/bin.bash
if [ -x "$(which dotbro 2>/dev/null)" ] ; then
echo "Dotbro is already installed."
exit 0
fi
if [ ! -x "$(which go 2>/dev/null)" ] ; then
echo "Golang is not installed."
echo "Downloading precompiled dotbro..."
@hypnoglow
hypnoglow / pre-commit
Last active May 23, 2016 10:10
eslint git hook
lint_it() {
changed_js_files=$( git diff --name-only HEAD | grep -E '(.js)$' )
if [ -z "${changed_js_files}" ] ; then
return 0
fi
eslint ${changed_js_files}
return $?
}
lint_it