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 / spotify
Created May 8, 2021 11:49
🎵 Spotify Stats
🎵
@ozh
ozh / plugin.php
Created April 7, 2021 16:37
YOURLS plugin : automatically login with yourls/yourls (for test installs)
<?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 April 7, 2021 16:33
YOURLS : add fake links (for test installs)
<?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 March 14, 2021 20:58
Backup all gists python script
#! /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 March 2, 2021 19:12
All possible hook syntaxes in YOURLS
<?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 February 26, 2021 22:58
edit files in a docker container
# 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 February 20, 2021 13:38
XAMPP PHP 7.4 and PHP 8

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).

@ozh
ozh / bk.md
Last active June 8, 2021 13:42
email + website @ gmail.com bookmarklet

Will populate active input field with "turlututu+<domain name>@gmail.com"

Code:

javascript:(function()%7Bvar%20w%20%3D%20window.location.hostname.replace(%2F%5Ewww%5C.%2F%2C%20'')%3Bw%20%3D%20w.replace(%2F%5C..%7B2%2C3%7D%24%2F%2C%20'').replace(%2F%5E.%2B%5C.%2F%2C%20'')%3Bvar%20i%20%3D%20document.activeElement%3Bif%20(i.tagName%20%3D%3D%20%22INPUT%22%20%7C%7C%20i.tagName%20%3D%3D%20%22TEXTAREA%22)%20%7Bi.value%20%3D%20'turlututu%2B'%20%2B%20w%20%2B%20'%40gmail.com'%3B%7D%7D)()

Expanded:

@ozh
ozh / omgtorrent.cz.md
Last active March 11, 2024 18:36
Torrent hash to magnet link bookmarklet

1) Bookmark this:

javascript:var magnetLink='magnet:?xt=urn:btih:'+document.getSelection();location.assign(magnetLink);

Highlight any torrent hash and click bookmarklet to generate and load magnet link

2) Bookmark this: