Skip to content

Instantly share code, notes, and snippets.

Avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
  • Ởżḥ đő† ợṝǧ
  • Naoned, Breizh, Bro-C'hall (Frañs)
View GitHub Profile
@ozh
ozh / check.md
Created May 19, 2021
Check platform requirement with Composer
View check.md

You can easily do a baseline test of whether your dependencies support PHP 8 using Composer's platform config by running for example:

composer config platform.php 8.0.5

# Checks whether latest versions of your dependencies (according to your
# version constraints) allow PHP 8
composer update --dry-run         

# Checks whether current versions of your deps allow PHP 8
@ozh
ozh / script-template.sh
Created May 19, 2021 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
View YOURLS_URL_CONVERT.md

Here are real life values of YOURLS_URL_CONVERT encountered in the wild:

(reminder: only 36 and 62 are acceptable values)

convert
0
0123456789
0123456789abcdefghijklmnopqrstuvwxyz-_.
@ozh
ozh / spotify
Created May 8, 2021
🎵 Spotify Stats
@ozh
ozh / plugin.php
Created Apr 7, 2021
YOURLS plugin : automatically login with yourls/yourls (for test installs)
View plugin.php
<?php
/*
Plugin Name: login yourls password yourls
Description: Just as the name says
Version: 0.1
Author: Ozh
*/
// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();
@ozh
ozh / plugin.php
Created Apr 7, 2021
YOURLS : add fake links (for test installs)
View plugin.php
<?php
/*
Plugin Name: Insert Fake Links
Plugin URI: http://yourls.org/
Description: Populate DB with fake links for tests
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
*/
@ozh
ozh / backup-gists.py
Created Mar 14, 2021
Backup all gists python script
View backup-gists.py
#! /usr/bin/env python
# To execute, copy script into a ~/gists directory, and 'python gist-backup.py'
# This will git clone every public and private gist of GITHUB-USER into that folder
# as well as a contents.txt folder.
# From : https://gist.github.com/ChristopherA/163aff3f1eeba9206d73
USER = 'ozh'
@ozh
ozh / test.php
Created Mar 2, 2021
All possible hook syntaxes in YOURLS
View test.php
<?php
// Load YOURLS
require_once( __DIR__.'/includes/load-yourls.php' );
?>
<pre>
<?php
// Simple hook with string <function name>
function my_callback_function($in) {
return "$in 1 ";
@ozh
ozh / edit-files-in-a-docker-container.md
Created Feb 26, 2021
edit files in a docker container
View edit-files-in-a-docker-container.md
# get list of container id
docker ps

# launch bash into container
# prefix with winpty if no terminal available (Windows)
winpty docker exec -it <id> bash

# Install an editor
apt-get update
@ozh
ozh / readme.md
Created Feb 20, 2021
XAMPP PHP 7.4 and PHP 8
View readme.md

Step 1: install XAMPP 7.4.1, make it work :) At this point you have C:/yourdir/xampp and in particular C:/yourdir/xampp/php and C:/yourdir/xampp/apache/conf/extra

Step 2 : download XAMPP 8.0.1, as a zip archive, not a self executable install Don't install it. Instead,

  • extract the content of the xampp/php directory and put it in C:/yourdir/xampp/php8
  • extract the file xampp/apache/conf/extra/httpd-xampp.conf and copy it to C:/yourdir/xampp/php and C:/yourdir/xampp/apache/conf/extra/httpd-xampp8.conf

Step 3 : edit C:/yourdir/xampp/php8/php.ini and modify the paths (eg replace all default \xampp with \yourdir\xampp).