Skip to content

Instantly share code, notes, and snippets.

View pavarov's full-sized avatar

Pavel Pivovarov pavarov

View GitHub Profile
@pavarov
pavarov / index.php
Created April 19, 2023 12:02 — forked from insideone/index.php
PHP date: вывод даты с русским названием месяца и возможностью склонения
<?php
function rdate($format, $timestamp = null, $case = 0)
{
if ($timestamp === null)
$timestamp = time();
static $loc =
'Январ,ь,я,е,ю,ём,е
Феврал,ь,я,е,ю,ём,е
@pavarov
pavarov / postgres-backup.sh
Created October 31, 2022 06:15 — forked from 4410287/postgres-backup.sh
Shell script for daily postgres database backup with basic archiving.
#!/bin/bash
# Written 2018-11-15 by 4410287
# This script will create a backup file of a postgres database and compress it. It is capable of access a local or remote server to pull the backup. After creating a new backup, it will delete backups that are older than 15 days, with the exception of backups created the first of every month. It is recommended to create a seperate database user specifically for backup purposes, and to set the permissions of this script to prevent access to the login details. Backup scripts for different databases should be run in seperate folders or they will overwrite each other.
HOSTNAME=
USERNAME=
PASSWORD=
DATABASE=
@pavarov
pavarov / SplClassLoader.php
Created June 23, 2022 05:15 — forked from jwage/SplClassLoader.php
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,