Skip to content

Instantly share code, notes, and snippets.

View ozh's full-sized avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
View GitHub Profile
@ozh
ozh / README.md
Created April 16, 2020 14:46
YOURLS: Old Pages (backward compatibility plugin for pages directory in root)

Plugin for YOURLS 1.7.7+: Old Pages

What for

Display pages that are located in <root>/pages/ instead of <root>/user/pages/

How to

  • In /user/plugins, create a new folder named old-pages
  • Drop these files in that directory
@ozh
ozh / notepad++plugins.md
Created April 14, 2020 19:12
Notepad++ plugins
@ozh
ozh / hooklist.pl
Created April 8, 2020 09:28
Perl script to generate hook list in YOURLS
#! /usr/bin/perl
use File::Find;
my $dir = '.';
my %actions;
my %filters;
$dir = $ARGV[0] if ($#ARGV != -1);
@ozh
ozh / readme.md
Created April 2, 2020 09:15
PHP timezone dropdown

Drop down of all timezones, grouped by Region, + a list of manual UTC offsets

@ozh
ozh / Init.php
Created October 8, 2017 17:34
Alternate bootstrap config class
<?php
/**
* YOURLS actions upon instantiating
*/
namespace YOURLS\Config;
class Init {
@ozh
ozh / funcdefined.php
Last active September 7, 2017 16:22
PHP : check where a function is defined
<?php
$reflFunc = new ReflectionFunction('function_name');
print $reflFunc->getFileName() . ':' . $reflFunc->getStartLine();
// eg /home/you/includes/file.php:60
@ozh
ozh / plugin.php
Created September 1, 2017 17:54
YOURLS Plugin: delete all URLs
<?php
/*
Plugin Name: RESET URLS
Plugin URI: http://yourls.org/
Description: OMG
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
*/
@ozh
ozh / yourls-propel.php
Last active September 6, 2017 20:27
Propel example with YOURLS
<?php
/* For the record: I played with Propel2 ORM and checked how I could use it with YOURLS.
*
* Setting up isn't complicated:
* - install Propel with composer
* - `vendor/bin/propel init` and answer quetions to generate the schema.xml, config file and mapped classes,
* based on an existing DB
*
* Using isn't very complicated, but there are quite many functions to tame.
@ozh
ozh / enable-query-log.php
Last active August 20, 2017 20:15
Enable query log in YOURLS
<?php
// Needs YOURLS 1.7.3+ with PDO/AuraSQL
$sql = "SET GLOBAL log_output = 'FILE';";
$ydb->exec($sql);
$sql = "SET GLOBAL general_log_file = '/path/to/logfile.log';";
$ydb->exec($sql);
$sql = "SET GLOBAL general_log = 'ON';";
$ydb->exec($sql);
@ozh
ozh / aura-fetch.php
Last active August 20, 2017 20:15
Aura.sql fetch* methods and their outputs
<?php
/**
* Table is :
* +-----------+-------------+--------------+
* | option_id | option_name | option_value |
* +-----------+-------------+--------------+
* | 1 | version | 1.7.2 |
* | 2 | db_version | 1337 |
* | 3 | next_id | 69 |
* +-----------+-------------+--------------+