Skip to content

Instantly share code, notes, and snippets.

Avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
View GitHub Profile
@ozh
ozh / yourls_share_tumblr.md
Created Apr 19, 2022
YOURLS Share on Tumblr
View yourls_share_tumblr.md

Plugin: Share on Tumblr

In the Quick Share box, add a one-click share to Tumblr link.

Install

  • In /user/plugins, create a new folder named quickshare-on-tumblr
  • In this new directory, create a blank file named plugin.php
  • In this new file, cut and paste the following code
  • Go to the Plugins administration page and activate the plugin
View YOURLS_with_IIS.md

Backup of probably obsolete https://github.com/YOURLS/YOURLS/wiki/Web-Config-IIS

What your web.config file for IIS should look like

Make a web.config file

If your YOURLS installation is on a IIS machine you have to create a web.config file. It's simple.

Case: YOURLS installed on root

@ozh
ozh / README.md
Created Apr 19, 2022
YOURLS Cherokee
View README.md
@ozh
ozh / YOURLS_db_drivers.md
Created Apr 2, 2022
YOURLS DB drivers in the wild
View YOURLS_db_drivers.md

Here are real life values of YOURLS_DB_DRIVER people use in their YOURLS config.php (data fetched on April 2022)

DB driver
gae
mongodb
mssql
mysql
@ozh
ozh / YOURLS_locales.md
Created Apr 2, 2022
YOURLS_LANG in the wild
View YOURLS_locales.md

Here are the values of YOURLS_LANG people use in their YOURLS config.php (real life data fetch on April 2022)

Locale
af_ZA
ar
ar-SA
ar_AR
ar_EG
@ozh
ozh / current_result.md
Created Mar 11, 2022
Future unit tests for `yourls_is_shorturl()`
View current_result.md

As of writing and with YOURLS 1.8.3-dev, expectedly works with http(s)://sho.rt/ozh but fail with http(s)://www.sho.rt/ozh (and logically if YOURLS_SITE has www. (eg http://www.sho.rt) the failures and success get inverted)

$ phpunit --filter ShortURL_Is_Shorturl_Tests
YOURLS installed, starting PHPUnit

PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.0.1 with Xdebug 3.0.2
Configuration: D:\home\planetozh\ozh.in\phpunit.xml
@ozh
ozh / blowfish.php
Created Feb 24, 2022
Blowfish hash cost : time estimates
View blowfish.php
<?php
// Some simple benchmark functions
function starttime() {
$r = explode( ' ', microtime() );
$r = $r[1] + $r[0];
return $r;
}
function endtime($starttime) {
@ozh
ozh / book.md
Created Oct 30, 2021
My bookmarklets
View book.md

G : search current image in Google reverse search

javascript:%20(function%20()%20%7Burl%20=%20location.href;location.href%20=%20'https://www.google.com/searchbyimage?&image_url='+url;%7D());

R : remove all redirects in links

javascript:(function(){var%20k,x,t,i,j,p;%20for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i>0){%20t=t.substring(i);%20j=t.indexOf('&');%20if(j>0)t=t.substring(0,j);%20p=/https?\:\/\/[^\s]*[^.,;'">\s\)\]]/.exec(unescape(t));%20if(p)%20x.href=p[0];%20}%20else%20if%20(x.onmouseover&&x.onmouseout){x.onmouseover();%20if%20(window.status%20&&%20window.status.indexOf('://')!=-1)x.href=window.status;%20x.onmouseout();%20}%20x.onmouseover=null;%20x.onmouseout=null;%20}})();
View ozhcar.py
>>> print(base64.urlsafe_b64encode(b'\x0c\xdfk\xfc'))
b'DN9r_A=='
>>> print((215968764).to_bytes(4, byteorder='big'))
b'\x0c\xdfk\xfc'
@ozh
ozh / count_loc.md
Created Sep 7, 2021
Count LOC in a directory
View count_loc.md

In directory :

$ wc -l `find . -type f -name '*php'`

Result :

    53 ./admin/admin-ajax.php
 324 ./admin/index.php