Skip to content

Instantly share code, notes, and snippets.

@anthonyaxenov
anthonyaxenov / s3-backup.sh
Last active December 23, 2023 20:26
[SHELL] Backup your project to another server
#!/bin/bash
#####################################################################
# #
# Stupidly simple backup script for own projects #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.2 #
# License: WTFPLv2 More info (RU): https://axenov.dev/?p=1272 #
# #
#####################################################################
@anthonyaxenov
anthonyaxenov / args.sh
Last active September 11, 2023 12:30
[SHELL] Argument parser for bash scripts without getopt or getopts
#!/bin/bash
#########################################################################
# #
# Argument parser for bash scripts #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.5 #
# License: MIT #
# #
#########################################################################
@anthonyaxenov
anthonyaxenov / convert.php
Last active August 3, 2023 08:38
[PHP] Simple Postman Collection to http converter
<?php
// This gist was erased.
// I recommend you to take a closer look at my new cli-tool:
//
// https://packagist.org/packages/axenov/pm-convert
//
// It can convert multple collections v2.1 to http/wget/curl formats
// very quickly and without 3rd-party dependencies.
@anthonyaxenov
anthonyaxenov / helpers.sh
Last active July 23, 2023 01:20
[SHELL] My bash helpers
#########################################################################
# #
# Bunch of helpers for bash scripting #
# #
# This file is compilation from some of my projects. #
# I'm not sure they're all in perfiect condition but I use them #
# time to time in my scripts. #
# #
#########################################################################
@anthonyaxenov
anthonyaxenov / stacktrace.sh
Last active June 28, 2023 14:10 — forked from akostadinov/stack_trace.sh
[SHELL] Print stacktrace
# 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 / install-golang.sh
Last active June 28, 2023 14:07
[SHELL] Install golang
#!/bin/bash
# GoLang installer
# 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
@anthonyaxenov
anthonyaxenov / set-resolution.sh
Last active June 28, 2023 14:07
[SHELL] Set display resolution
#!/bin/bash
#########################################################################
# #
# Set display resolution #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.0 #
# License: WTFPL #
# #
#########################################################################
@anthonyaxenov
anthonyaxenov / .bash_aliases
Last active June 28, 2023 13:49
[SHELL] My favorite bash aliases
#!/bin/bash
# alias bashrc='source ~/.bashrc'
alias zshrc='source ~/.zshrc'
alias realias='source ~/.bash_aliases'
alias reload='exec ${SHELL} -l'
alias sudo='sudo ' # enable aliases to be sudo’ed
alias g='git'
alias hosts="sudo nano /etc/hosts"
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
@anthonyaxenov
anthonyaxenov / inotifywait-cp.service
Last active April 19, 2023 03:56
[SHELL] Backup files synced from Syncthing
# Daemon file
# Place or symlink it to /etc/systemd/system/inotifywait-cp.service
# Enable and start: sudo systemctl enable --now inotifywait-cp
# Check it: sudo systemctl status inotifywait-cp
[Unit]
Description=Photosync from android
[Service]
Type=simple
@anthonyaxenov
anthonyaxenov / php
Last active March 27, 2023 03:08
[SHELL] Interpreter helper to debug dockerized cli php scripts in NetBeans
#!/bin/bash
# Welcome to amusement park!
[[ "$1" = '--help' ]] || [[ "$1" = '-h' ]] && cat <<EOF && exit
NetBeans docker wrapper for php
===============================
Anthony Axenov (c) 2023, The MIT License
https://axenov.dev
https://opensource.org/license/mit