Skip to content

Instantly share code, notes, and snippets.

View raoulwegat's full-sized avatar

Raoul Wegat raoulwegat

View GitHub Profile
@raoulwegat
raoulwegat / com.user.smbmount.plist
Created November 16, 2025 05:15
Mount SMB in macos 15 on boot
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.smbmount</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
@raoulwegat
raoulwegat / InvalidateCloudFront.php
Last active May 3, 2025 04:58
Statamic Action to invalidate AWS CloudFront images when using S3+CloudFront for image caching
<?php
namespace App\Actions;
use Aws\CloudFront\CloudFrontClient;
use Illuminate\Support\Str;
use Statamic\Actions\Action;
use Statamic\Assets\Asset;
use Statamic\Imaging\ImageGenerator;
@raoulwegat
raoulwegat / parallels-for-desktop-downloads.md
Created February 17, 2025 05:25
Parallels Desktop for Mac point version download URLs

Parallels International Gmbh don't link to previous point release for their software which makes it difficult for those who happen to find themselves at the whipping end of their QA team's failures.

So if you're after a particular version - for me because updates keep breaking Parallel Tools in so many weird and wonderful ways - you can get a specific point version using the following URL format:

https://download.parallels.com/desktop/v19/19.4.1-54985/ParallelsDesktop-19.4.1-54985.dmg https://download.parallels.com/desktop/v20/20.1.3-55743/ParallelsDesktop-20.1.3-55743.dmg

The specific versions and build numbers can be sourced from their updates pages:

Parallels Desktop 19 updates summary

@raoulwegat
raoulwegat / override puppeteer default browser.md
Created October 18, 2023 00:29
override puppeteer default browser.md

override puppeteer default browser

When using criticalCSS on Apple Silicon hardware in an arm64 linux virtual machine, puppeteer installs an x86-64 version of chromium which will not launch and will cause and npm run command to fail.

This problem can be solved by firstly installing chromium-browser which is a native arm64 and x86-64 build:

sudo apt install chromium-browser
@raoulwegat
raoulwegat / Get PHP-FPM Average Memory Usage.md
Last active September 16, 2023 04:32
PHP-FPM Average Memory Usage.md

Get PHP-FPM Average Memory Usage

ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm
@raoulwegat
raoulwegat / _readme.txt
Last active May 2, 2023 08:16
Including Photoswipe 5.2+ with laravelmix/webpack 4
Photoswipe 5.2 was rewritten in ES6 and it needs to be transpiled to ES5 to work with Laravel Mix 4 (which used Webpack 4).
If you try a regular import as per the Photoswipe docs, it won't work. You'll need to add this webpack config to your
webpack.mix.js and import the modules in your js file as per below.
@raoulwegat
raoulwegat / md2html.py
Last active November 18, 2022 02:34
Convert a directory of *.md to *.html. Based on https://gist.github.com/jiffyclub/5015986
#!/usr/bin/python3
import sys
import os
import re
import jinja2
import markdown
TEMPLATE = """<!DOCTYPE html>
@raoulwegat
raoulwegat / convert-svg-png.sh
Created February 16, 2017 19:26
Convert SVG to PNG
#!/bin/bash
# Batch convert SVG to PNG. Useful for creating new sizes of twemoji.
# Uses https://wiki.gnome.org/Projects/LibRsvg. On macOS install with 'brew install librsvg'
for file in svg/*.svg
do
filename="$(basename $file)"
name=$(echo $filename | cut -f 1 -d '.')
echo "Converting $file to $name.png"
rsvg-convert -h 36 -w 36 $file > 36x36/$name.png
done
@raoulwegat
raoulwegat / gist:fc8e1b7a95e97eca70e5
Created April 1, 2015 01:49
WordPress custom post type with custom ordered post navigation
<?php
/*
* I have a custom post type for my Portfolio, using Advanced Custom Fields for extra fields including a field for me to
* order the portfolio entires how I want. Standard single navigation using previous_post_link and next_post_link don't work as they
* return the order the posts were added. This fixes things:
*/
// New query
$args = array(
@raoulwegat
raoulwegat / gist:f3aa71e103e59ef7105f
Created March 26, 2015 00:16
Ubuntu 14 Varnish 4 init.d
sudo update-rc.d varnish defaults 91 9