Skip to content

Instantly share code, notes, and snippets.

Avatar
🇷🇺

Anthony Axenov anthonyaxenov

🇷🇺
View GitHub Profile
@anthonyaxenov
anthonyaxenov / install-golang.sh
Created Oct 20, 2021
[SHELL] Install golang on debian-like OS
View install-golang.sh
#!/bin/bash
# https://golang.org/doc/install
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
# if [ "$EUID" -ne 0 ]
# then echo "*** root permissions required ***"
# exit
# fi
[ $1 ] && VERSION="$1" || VERSION="1.17.2"
@anthonyaxenov
anthonyaxenov / stacktrace.sh
Last active Aug 29, 2021 — forked from akostadinov/stack_trace.sh
[BASH] Print stacktrace
View stacktrace.sh
# Original: https://gist.github.com/akostadinov/33bb2606afe1b334169dfbf202991d36
# The difference is that this func outputs stacktrace in reverse order (from top level to lower ones)
function print_stacktrace () {
STACK=""
local i
local stack_size=${#FUNCNAME[@]}
echo "Stacktrace:"
# skip this function and "MAIN non_file_source:0"
for (( i=$stack_size-1; i>=1; i-- )); do
local func="${FUNCNAME[$i]}"
@anthonyaxenov
anthonyaxenov / zsh-fancify.sh
Last active Jul 15, 2021 — forked from AlexZeitler/setup-oh-my-zsh-powerlevel9k.sh
Installing zsh / oh-my-zsh / Powerlevel10k on Ubuntu 20.04
View zsh-fancify.sh
#!/bin/bash
# Based on:
# https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions
# https://github.com/ohmyzsh/ohmyzsh
# https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation
# https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95
# https://linuxhint.com/install_zsh_shell_ubuntu_1804/
echo "*********************************************"
echo " zsh fancifier"
@anthonyaxenov
anthonyaxenov / set-resolution.sh
Created Jun 20, 2021
[BASH] Set display resolution
View set-resolution.sh
#!/bin/bash
#########################################################################
# #
# Set display resolution #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.0 #
# License: WTFPL #
# #
#########################################################################
@anthonyaxenov
anthonyaxenov / args.sh
Last active May 27, 2021
[BASH] Argument parser for bash scripts without getopt or getopts
View args.sh
#!/bin/bash
#########################################################################
# #
# Argument parser for bash scripts #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.5 #
# License: MIT #
# #
#########################################################################
@anthonyaxenov
anthonyaxenov / io.sh
Last active Jan 30, 2021
[BASH] Полезные скрипты для переиспользования
View io.sh
#!/bin/bash
# source: https://misc.flogisoft.com/bash/tip_colors_and_formatting
########################################################
# Иконки
########################################################
IINFO="[ i ]"
INOTE="[ * ]"
IWARN="[ # ]"
@anthonyaxenov
anthonyaxenov / menu.php
Created Oct 13, 2020
[PHP] Пример рекурсивного вывода меню
View menu.php
<?php
$nav = [
[
'name' => 'Home',
'title' => 'Homepage',
// ...something else...
'sub' => [
[
'name' => 'sub11',
'title' => null,
@anthonyaxenov
anthonyaxenov / decode.php
Last active Sep 23, 2020
[PHP] Simple equivalent of Oracle's decode()
View decode.php
<?php
/**
* Simple php equivalent of Oracle's decode()
*
* It can be used as simple oneline-alternative to switch or if operators in many
* cases without difficult logic. For example, get string mnemocode of some value:
*
* echo 'State: '.decode($state, 0, 'disabled', 1, 'enabled', 'unknown');
*
@anthonyaxenov
anthonyaxenov / coalesce.php
Created Sep 23, 2020
[PHP] Simple equivalent of Oracle's coalesce()
View coalesce.php
<?php
/**
* Simple php equivalent of Oracle's coalesce()
*
* It can be used as simple oneline-alternative to switch or if operators in many
* cases without difficult logic. For example, get first non-empty value from bunch of vars:
*
* echo coalesce($var1, $var2, $var3, ...);
*
@anthonyaxenov
anthonyaxenov / .gitconfig
Last active Sep 9, 2020
Мой gitconfig с полезными алиасами
View .gitconfig
# ....прочие личные настройки...
[push]
default = current
[pull]
default = current
[core]
editor = code
autocrlf = input
[alias]
# общее -----------------------------------------------------------------