Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Axenov anthonyaxenov

View GitHub Profile
@anthonyaxenov
anthonyaxenov / .gitconfig
Created Sep 28, 2022
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.sh
Created Sep 27, 2022
[SHELL] Backup files synced from Syncthing
View inotifywait-cp.sh
#!/bin/bash
# My use case:
# syncthing synchronizes ALL changes in DCIM directory on my android to PC.
# I wanted files to be copied somewhere else on my PC to stay forever, so I
# could sort them later and safely free some space on mobile without loss.
# Also I wish to have some stupid log with history of such events.
# inotify-tools package must be installed!
# CHANGE THIS PARAMETERS to ones you needed
@anthonyaxenov
anthonyaxenov / s3-backup.sh
Last active Aug 19, 2022
[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 Sep 17, 2022
[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 Aug 24, 2022
[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 Feb 20, 2022
[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 Jan 17, 2022
[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
@anthonyaxenov
anthonyaxenov / install-golang.sh
Last active Feb 23, 2022
[BASH] Install golang
View install-golang.sh
#!/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 / output.php
Last active Dec 24, 2021
[PHP] Simple and universal file logger
View output.php
<?php
function output(...$data)
{
$result = [];
foreach ($data as $something) {
if ($something instanceof Illuminate\Support\Collection) {
$something = $something->toArray();
}
if (is_array($something)) {
$something = var_export($something, true);
@anthonyaxenov
anthonyaxenov / BasicTestCase.php
Last active Jan 21, 2022
[PHP] Useful phpunit asserts
View BasicTestCase.php
<?php
declare(strict_types = 1);
namespace Tests;
use Illuminate\Support\Collection;
use PHPUnit\Framework\TestCase;
class BasicTestCase extends TestCase