Skip to content

Instantly share code, notes, and snippets.

@sutlxwhx
sutlxwhx / Renamer.php
Last active August 24, 2018 23:13
Rename all files in the current folder according to your list of file names
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / Copier.php
Last active August 24, 2018 23:13
Copy specified files to the new directory
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / Sizer.php
Last active August 24, 2018 23:15
Sort files in the folder by their file size and retrieve it as an array
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / Checker.php
Last active August 24, 2018 23:14
Check if mysql database exists
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / schema.md
Last active August 21, 2018 17:32
Rich snippet with star rating in SERP for your website / article

Introduction

According to Google Introduction to Structured Data either schema.org or JSON-LD markup should be enough for Google to pickup structuted data on your website / article. I used them both. In my experince Google was able to pickup breadcrubs within JSON-LD faster while star rating with schema.org was easily to implement.

Installation

Because most of the code is not visible to visitors and it's ok you you split your breadcrumbs and star rating into different instances on the page I encourage you to set the rating data over the h1 tag. It's better if you use div itemprop="name" and it's bad if you will create 2 isntances of h1 tag just to fit my example.

  • h1 stands for your h1 tag
  • "ratingValue" determines the final rating of your article
@sutlxwhx
sutlxwhx / extract.js
Last active August 20, 2018 18:15
Copy to the clipborad list of all h1/h2/h3 elements on the page
# Declare tag name that you want to extract
var elements = document.getElementsByTagName("h2");
# Create a temporary element where all the data will be stored
var buffer = document.createElement("buffer");
document.body.appendChild(buffer);
# Declare the string var where all the data from the page will be stored
var names = '';
# Create a foor loop and append all new elements to the string
for(var i=0; i<elements.length; i++) {
names += elements[i].innerText + '\n';;
@sutlxwhx
sutlxwhx / README.md
Last active October 28, 2023 07:29
Comparison of different popular VPS providers
@sutlxwhx
sutlxwhx / Empt.php
Last active August 24, 2018 23:14
Delete empty lines in the file and save it
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / README.md
Last active February 22, 2024 01:43
Synchronize folders between two servers using rclone and ssh-agent with ssh based authorisation

Introduction

This tutorial will help you transfer your folders / files between two server using rclone and ssh-agent.
It was tested between two Ubuntu 16.04 servers.

Installation

First things first. We need to install the neccessary packages:

apt-get update -y
@sutlxwhx
sutlxwhx / backup.sh
Last active February 1, 2024 21:08
Backup all your MySQL / MariaDB databases with rclone
#!/usr/bin/env bash
# To run this script you need to install https://rclone.org/ first
# Use current date and time for future backup folder name
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
# Declare the directory where the temporary backup files will be stored
BACKUP_DIR="/backup/$TIMESTAMP/mysql"
# State the username for your MySQL / MariaDB instace that can access the neccessary databases
MYSQL_USER=""
# Point this script to mysql executable file
MYSQL=/usr/bin/mysql