Skip to content

Instantly share code, notes, and snippets.

Avatar

Nemanja Avramović avramovic

View GitHub Profile
@avramovic
avramovic / PasswordValidator.php
Last active Mar 24, 2021
Laravel 5+ password validation rules
View PasswordValidator.php
<?php
namespace App\Validators;
class PasswordValidator
{
public function validateLetters($attribute, $value)
{
return preg_match('/\pL/', $value);
}
@avramovic
avramovic / gitclean.sh
Last active Dec 1, 2020
Clean up merged Git branches
View gitclean.sh
#!/usr/bin/env bash
if [ ! -d .git ]; then
echo "Not a git repository!"
exit 1
fi
currentBranch=`git status | grep "On branch" | awk '{ print $3 }'`
echo "You are on branch:" $currentBranch
@avramovic
avramovic / backup-db.sh
Created Dec 10, 2019
Simple linux shell backup to s3 with s3cmd
View backup-db.sh
#!/usr/bin/env bash
SQLDUMP="$1_db_$(date +'%Y%m%d%H%M').sql.gz"
echo "Creating backup of database to $SQLDUMP..."
/usr/bin/mysqldump --login-path=local --databases $1 | gzip -9 > $SQLDUMP
echo "Uploading zipped dump to the Amazon S3 bucket..."
/usr/bin/s3cmd put $SQLDUMP s3://your.s3.bucket.hostname/database/$SQLDUMP
echo "Removing the backup file $SQLDUMP"
@avramovic
avramovic / proof.txt
Last active Aug 12, 2020
Twinery sidebar stats
View proof.txt
Simple sidebar
The beginning
=============
(set: $money to 500)
You came to the lake and have some money with you. Stamina is irrelevant right now.
@avramovic
avramovic / overnewser.user.js
Created Sep 7, 2017
Google Chrome userscript to skip annoying overnewser.com countdown
View overnewser.user.js
/**
* To install, save this file as overnewser.user.js and drag/drop it into your chrome://extensions page
*/
// ==UserScript==
//
// @name UnderNewser
// @description Skip annoying overnewser.com waiting time
// @namespace http://www.avramovic.info
// @author Nemanja (http://twitter.com/avramator)