Skip to content

Instantly share code, notes, and snippets.

View golubov-andrey's full-sized avatar

Golubov Andrey golubov-andrey

View GitHub Profile
import isEqual from 'lodash.isequal';
/**
* Pattern matching
* ```
* matching(item)(
* { match: 1, then: { tag: 'Left' }}
* { match: 2, then: { tag: 'Right' }}
* )
* /// { tag: 'Left' } | { tag: 'Right' }
@golubov-andrey
golubov-andrey / $HOME_bin_passgen
Created November 1, 2018 15:44
Generate password with help openssl
#!/bin/bash
if [ -z "$1" ] ; then
charNum=10
else
charNum="$1"
fi
openssl rand -base64 128 | egrep -o '[A-Za-z0-9]' | tr -d '\n' | cut -c1-$charNum
@golubov-andrey
golubov-andrey / $HOME_bin_n2dissite
Created November 1, 2018 15:42
Disabled Nginx site
#!/bin/bash
SITE=$1
CFG_SITE="/etc/nginx/sites-available/$SITE.conf"
CFG_TARGET="/etc/nginx/sites-enabled/$SITE.conf"
if [ -z $SITE ] ; then
echo "First parameter is nil. Enter needed site disabled"
elif [ -f $CFG_TARGET ] ; then
@golubov-andrey
golubov-andrey / $HOME_bin_n2ensite
Created November 1, 2018 15:41
Enable Nginx site
#!/bin/bash
SITE=$1
CFG_SITE="/etc/nginx/sites-available/$SITE.conf"
CFG_TARGET="/etc/nginx/sites-enabled/$SITE.conf"
if [ -z $SITE ] ; then
echo "First parameter is nil. Enter needed site enabled"
elif [ -f $CFG_SITE ] ; then
ln -s $CFG_SITE $CFG_TARGET
@golubov-andrey
golubov-andrey / etc_libvirt_hooks_qemu
Last active November 30, 2021 22:47
Forward qemu port to host machine
#!/bin/bash
# More information on https://www.libvirt.org/hooks.html
# and https://wiki.libvirt.org/page/Networking
GUEST_NAME=$1
GUEST_STATE=$2
function forward {
INTERFACE=$1
PROTOCOL=$2