Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Axenov anthonyaxenov

View GitHub Profile
@anthonyaxenov
anthonyaxenov / php
Last active March 27, 2023 03:08
[SHELL] Interpreter helper to debug dockerized cli php scripts in NetBeans
View php
#!/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
@anthonyaxenov
anthonyaxenov / here.php
Last active March 24, 2023 08:38
[PHP] Get caller class, function and line number
View here.php
<?php
/**
* Returns caller class/file name, function and line where current
*
* Potentially doesn't cover all cases, but is simple and pretty handy for use in frameworks.
*
* @param bool $as_array result as array or string in this format: `<file|class>:<func>():<line>`
* @return string|array
*/
@anthonyaxenov
anthonyaxenov / ytdlcue.sh
Last active October 9, 2022 05:23
[SHELL] CUE-sheet generator for youtube-dl
View ytdlcue.sh
#!/bin/bash
# CUE-sheet generator for youtube-dl
# Usage:
# 0. Install 'jq' utility
# 1. Download any audio file with metadata from YouTube or Youtube Music, e.g.
# $ youtube-dl \
# --extract-audio \
# --audio-format flac \
# --audio-quality 0 \
@anthonyaxenov
anthonyaxenov / .gitconfig
Created September 28, 2022 00:02
My favourite global .gitconfig with aliases (ru comments)
View .gitconfig
[user]
# ...
# signingkey = <key>
# git config user.signingkey ... -- установить ключ
[commit]
gpgSign = true
[tag]
gpgSign = true
[push]
default = current
@anthonyaxenov
anthonyaxenov / inotifywait-cp.service
Last active April 19, 2023 03:56
[SHELL] Backup files synced from Syncthing
View inotifywait-cp.service
# 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 / s3-backup.sh
Last active May 31, 2023 15:25
[SHELL] Backup your project to another server
View s3-backup.sh
#!/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 / .bash_aliases
Last active September 17, 2022 14:30
[SHELL] My favourite bash aliases
View .bash_aliases
#!/bin/bash
# alias bashrc='source ~/.bashrc'
alias zshrc='source ~/.zshrc'
alias realias='source ~/.bash_aliases'
alias ..="cd .."
alias chmod="chmod --preserve-root"
alias chown="chown --preserve-root"
alias free="free -h"
@anthonyaxenov
anthonyaxenov / quick-backup.sh
Last active August 24, 2022 05:02
[SHELL] Backup your project to another server
View quick-backup.sh
#!/bin/bash
#####################################################################
# #
# Stupidly simple backup script for own projects #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.0 #
# License: WTFPLv2 More info: https://axenov.dev/?p=1423 #
# #
#####################################################################
@anthonyaxenov
anthonyaxenov / dc.sh
Last active December 7, 2022 15:01
[SHELL] Simple tool for your docker-compose environment
View dc.sh
#!/bin/bash
CONTAINER="ds-php" # the name of the container in which to 'exec' something
CONFIG="$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))/docker-compose.yml" # path to compose yml file
CMD="docker-compose -f $CONFIG" # docker-compose command
APP_URL='http://localhost:8000/'
open_browser() {
if which xdg-open > /dev/null; then
xdg-open "$1" </dev/null >/dev/null 2>&1 & disown
elif which gnome-open > /dev/null; then
@anthonyaxenov
anthonyaxenov / convert.php
Last active January 17, 2022 06:47
[PHP] Simple Postman Collection to http converter
View convert.php
#!/bin/php
<?php
/***********************************************************************************************************************
* Simple Postman Collection Converter
*
* Author: Anthony Axenov (c) 2021
* Version: v1.1
* License: MIT
* Dependecies: php8.0, php-json