Skip to content

Instantly share code, notes, and snippets.

View avramovic's full-sized avatar

Nemanja Avramović avramovic

View GitHub Profile
@avramovic
avramovic / overnewser.user.js
Created September 7, 2017 23:11
Google Chrome userscript to skip annoying overnewser.com countdown
/**
* 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)
@avramovic
avramovic / backup-db.sh
Created December 10, 2019 10:06
Simple linux shell backup to s3 with s3cmd
#!/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 August 12, 2020 08:08
Twinery sidebar stats
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 / PasswordValidator.php
Last active March 24, 2021 18:02
Laravel 5+ password validation rules
<?php
namespace App\Validators;
class PasswordValidator
{
public function validateLetters($attribute, $value)
{
return preg_match('/\pL/', $value);
}
@avramovic
avramovic / GumPress.php
Last active September 28, 2021 10:58
Download GumPress.php and save it in your theme/plugin folder!
<?php defined("\x41\x42\x53\x50\x41\124\110") or die("\x4e\157\x20\163\x63\x72\x69\160\164\x20\153\x69\144\144\151\x65\x73\x20\160\154\x65\x61\163\145\x21"); class GumPress { private array $YKZi6; private string $UZ7R4 = ''; public function __construct($tajN0 = []) { $this->YKZi6 = $tajN0; } public function config($pWjal, $I89yt = null) { return $this->YKZi6[$pWjal] ?? $I89yt; } public function callback($pWjal, $I89yt = null) { return $this->YKZi6["\143\141\154\154\x62\141\143\x6b\x73"][$pWjal] ?? $I89yt; } public function license($MwtkT = null) { $Eqv1I = $this->license_key(); if (!empty($Eqv1I)) { goto xb3P3; } return null; xb3P3: $q_2ax = $this->module_slug("\154\151\x63\145\x6e\163\145\x5f\143\x61\x63\150\145"); $pep03 = get_transient($q_2ax); $MwtkT = $MwtkT ?: $this->config("\x6c\x69\x63\x65\156\163\145\x5f\143\150\x65\x63\153\x5f\165\x72\x6c", "\x68\164\x74\x70\x73\x3a\57\x2f\x61\160\x69\56\x67\x75\155\x72\x6f\x61\x64\x2e\x63\x6f\155\57\166\x32\57\154\x69\143\145\x6e\x73\x65\163\57\166\145\162\x69\x66\
@avramovic
avramovic / encrypt.php
Created September 28, 2021 10:58
Config encryption tool for GumPress
<?php function cr($yCDd6) { return sprintf("\x25\x75", crc32($yCDd6)); } function dh($yCDd6) { return dechex($yCDd6); } function r($yCDd6) { return str_rot13($yCDd6); } function t($yCDd6) { return trim($yCDd6, "\75"); } function b($yCDd6) { return base64_encode($yCDd6); } function j($yCDd6) { return json_encode($yCDd6); } function g($yCDd6) { return gzdeflate($yCDd6, 9); } if (php_sapi_name() == "\143\154\x69") { goto cMbG0; } die("\116\157\40\144\x6f\x67\x73\40\x61\154\x6c\x6f\167\145\x64\x21"); goto Cy3EX; cMbG0: $TcxzK = $argv[1]; $q2oF1 = $argv[2]; if (!empty($TcxzK)) { goto uFqpC; } print "\105\122\x52\x4f\122\x3a\40\x41\x72\147\x75\155\x65\x6e\x74\x20\x31\40\151\x73\x20\162\145\x71\165\151\x72\x65\x64\41" . PHP_EOL; exit(1); uFqpC: if (!empty($q2oF1)) { goto X2Z_I; } print "\x45\122\x52\117\x52\x3a\x20\x41\x72\x67\x75\155\145\156\x74\x20\x32\40\x69\x73\x20\x72\145\x71\165\x69\x72\x65\144\41" . PHP_EOL; exit(1); X2Z_I: if ($YhU_p = json_decode($q2oF1, true)) { goto xY9MR; } print "\x45\122\122\x4f\122\x3
@avramovic
avramovic / newrelic.config
Created May 18, 2022 13:29
New Relic PHP agent (v9.21) on AWS Elastic Beanstalk AMI Linux 2 (arm based cpu)
files:
"/etc/httpd/conf.modules.d/11-mpm.conf":
mode: "000755"
owner: root
group: root
content: |
LoadModule mpm_event_module modules/mod_mpm_event.so
"/etc/php.d/20-newrelic.ini":
mode: "000755"
@avramovic
avramovic / gitclean.sh
Last active March 28, 2024 08:44
Clean up merged Git branches
#!/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