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 / prettier-against-branch.md
Created May 8, 2026 17:06
Run prettier only against files of a PR

This script runs bunx prettier --check against all files committed in a branch that differ from main (git diff main...HEAD). Having --diff-filter=AM means "only Added and Modified" (not deleted)

Workflow:

  • modify, commit
  • check with this script (bash script.sh from repo root)
  • edit last line from --check to --write if wanting to "fix"
  • push
@ozh
ozh / cdhere.md
Created May 6, 2026 19:42
`cdhere` : `cd` to wherever the last active Nemo window was

In your .bashrc or alias/functions definitions:

cdhere() {
    # Get all Nemo window IDs
    nemo_ids=$(xdotool search --classname nemo)

    # Get stacking order (last = most recently focused)
    stacking=$(xprop -root _NET_CLIENT_LIST_STACKING \
 | grep -oP '0x[0-9a-f]+' \
@ozh
ozh / open-php-with-phpstorm-or-geany.md
Created May 3, 2026 15:32
Open PHP with PhpStorm if already running, lightweight editor otherwise

Smart PHP file opener: PhpStorm if running, Geany otherwise

Double-click a .php file in Nemo: this setup opens it in PhpStorm only if PhpStorm is already running, or falls back to Geany otherwise.

The idea is that whenever I just want a quick edit, I don't want to load PhpStorm. And whenever I'm really coding, PhPStorm is already open.

Setup

@ozh
ozh / nemo-action-git-diff-meld.md
Created April 28, 2026 17:15
Nemo action: Git diff with Meld

Nemo action: Git diff with Meld

Right-click any file, folder, or the background of a Nemo window inside a git repository to open a diff in Meld.

image
  • Right-click a file - diff that file
  • Right-click a folder icon - diff the contents of that folder
  • Right-click the empty area of a Nemo window - diff the contents of the current directory
@ozh
ozh / apt.md
Created April 22, 2026 08:30
apt crash course

APT Crash Course

apt est le gestionnaire de paquets des distributions basées sur Debian/Ubuntu.


Les essentiels

Mettre à jour la liste des paquets

@ozh
ozh / bookmarklets.md
Created April 21, 2026 17:34
bookmarklets

G: sends the current page URL to Google to perform a reverse image search:

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

R: cleans up links on a page (notably from Google) by removing redirect/tracking wrappers and restoring the direct URLs

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}})();
@ozh
ozh / Dockerfile
Created April 18, 2026 14:31
My docker for web dev
FROM php:8.5-apache
# System deps
RUN apt-get update && apt-get install -y \
git \
unzip \
libpq-dev \
libzip-dev \
&& docker-php-ext-install \
pdo \
@ozh
ozh / linux.md
Last active May 3, 2026 15:35
My linux desktop setup
@ozh
ozh / docker.md
Created April 18, 2026 11:54
Docker crash course tutorial

🐳 Docker Crash Course (Linux)


🧠 Concepts de base

Docker repose sur 4 briques :

  • Images → templates (nginx, php, etc.)
  • Containers → instances exécutées
@ozh
ozh / index.php
Created April 18, 2026 10:45
index.php listing all projects and files
<?php
$dir = __DIR__; // change this to your target directory
$items = scandir($dir);
$dirs = [];
$files = [];
foreach ($items as $item) {