Skip to content

Instantly share code, notes, and snippets.

@andyexeter
andyexeter / splitting-claude-personal-and-work.md
Last active October 10, 2026 20:05
Running Claude personal and work side by side on one Mac (separate Claude Code configs, logins and desktop app instances)

Running Claude personal and work side by side on one Mac

This setup runs two Claude accounts on one Mac, a personal one and a work one, and keeps them completely separate. Each account gets its own desktop app window, Claude Code config, login, memories, transcripts and folder trust. The only things they share are the parts you choose to share.

The setup assumes macOS, zsh, jq, and Claude Code installed both as the CLI and through the desktop app's Code tab.

The end state

Config folder Login How it's selected
@andyexeter
andyexeter / README.md
Last active January 24, 2022 14:21
AccessPress Compromised WordPress Plugins
@andyexeter
andyexeter / imageoptim.sh
Last active January 16, 2020 14:02
ImageOptim Shell Script
#!/usr/bin/env sh
# Optimise images using the ImageOptim API
# Usage example: find images/ -type f -print0 | xargs -0 -n 1 -P 0 ./imageoptim.sh
# Usage example 2: ./imageoptim.sh file.jpg
# ImageOptim API Key (https://imageoptim.com/api/register)
api_key=''
@andyexeter
andyexeter / envimport.php
Last active April 18, 2020 16:16
Take env vars from a Symfony parameters.yml.dist file and put them in a .env.dist file
<?php
require __DIR__ . '/vendor/autoload.php';
$yaml = \Symfony\Component\Yaml\Yaml\Yaml::parseFile(__DIR__ . '/app/config/parameters.yml.dist');
$lines = [];
foreach ($yaml['parameters'] as $key => $value) {
if (strpos($key, 'env(') === 0 && substr($key, -1) === ')' && $key !== 'env()') {
$lines[] = substr($key, 4, -1) . '=' . "'$value'";
}
@andyexeter
andyexeter / slugify.php
Created April 17, 2018 12:12
Converts a string into a slug
<?php
/**
* Returns a slugified version of a string
*
* E.g: Hello World becomes hello-world
*
* @param string $input
*
* @return string
@andyexeter
andyexeter / interpolate.php
Created November 12, 2017 00:41
Interpolates a handlebars style template with given data
<?php
/**
* Interpolates a handlebars style template with the given data.
*
* e.g: interpolate('Hello, {{ name }}', ['name' => 'Joe Bloggs']);
*
* @param string $template
* @param array $data
* @return string mixed
*/
@andyexeter
andyexeter / getQueryObj.js
Created October 10, 2017 10:59
JavaScript function to return a query string as an object
function getQuery(query) {
query = query || window.location.search;
var queryString = {};
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
pair[0] = decodeURIComponent(pair[0]);
pair[1] = decodeURIComponent(pair[1]);
// If first entry with this name
@andyexeter
andyexeter / bump_version.sh
Last active June 13, 2024 16:51
Bash script to increment version numbers in multiple files
#!/usr/bin/env bash
# Usage: ./bump_version.sh <major|minor|patch> - Increments the relevant version part by one.
#
# Usage 2: ./bump_version.sh <version-from> <version-to>
# e.g: ./bump_version.sh 1.1.1 2.0
set -e
# Define which files to update and the pattern to look for
@andyexeter
andyexeter / interpolate.js
Created March 20, 2017 20:45
Interpolates a handlebars-ish template
/**
* Converts a handlerbars-ish template to HTML.
* Only supports scalar value access within an object.
*
* e.g: interpolate('<h1>{{title}}</h1>', {title: 'Hello World'});
*
* @param {string} template The handlebars-ish template.
* @param {object} data Data object with which to parse the template.
* @returns {string} The interpolated string.
*/
@andyexeter
andyexeter / sizeFormat.php
Created January 22, 2017 15:05
sizeFormat function for PHP - Extracted from WordPress core
<?php
/**
* Convert number of bytes largest unit bytes will fit into.
* Extracted from WordPress core to work as a standalone function.
*
* @link https://codex.wordpress.org/Function_Reference/size_format
*
* @param int|string $bytes Number of bytes. Note max integer size for integers.
* @param int $decimals Optional. Precision of number of decimal places. Default 0.