1021Facebook Custom Share Link

Facebook's depreciate Custom Share Link (as of 2022). Still work, but not recommended.


Share this post!

1019Importing Screenshots to Photos with Automator

A simple Automator Action to import Screenshots in OSX into Photos:

  • Select the Folder to which the Action is attached
  • "Add to existing top-level album" - called "Screenshots"

I also have my Screenshots Folder on Dropbox, the Folder Actions are attached to that Folder.

1017Finding and Deleting Files without Content

Finds all empty JPEGs at current directory:

find . -maxdepth 1 -name "*.jpg" -size 0

Finds and deletes all empty JPEGs at current directory:

find . -maxdepth 1 -name "*.jpg" -size 0 -delete

Finds and deletes all empty JPEGs in all sub-directories.

find . -maxdepth 2 -name "*.jpg" -size 0 -delete

Sources: 1, 2

1014Installing IIJmio Sim-Card on iPhone

Problem: IIJMIO Network not working: Solution: Dowload and Install Profile 1. Go to https://t.iijmio.jp/en/apn/ 2. Download and Install the Profile 3. That’s it.

1010Importing MySQL dump file into Database

Working with XAMPP and and phpMyAdmin makes dealing with databases more visual, but importing large db dumb files can fail/take a long time.

Importing from the command line is faster and more stable.

Use the XAMPP mysql, if there is not a global mysql

cd /Applications/XAMPP/xamppfiles/bin 


./mysql -u root -p db_name < ~/path/to/db/file.sql
  • Importing a ca. 300MB file takes ca. 5 seconds.
  • Make sure the DB "db_name" already exists.

1008JS Loops and async/await

I've been trying to get data from an API, a async call is used to parse the data. I've be naively iterating over the responses with forEach, calling await in the forEach function, and wondering why it is not producing the result I expected, i.e. wait for the data to settle.


async function getData() {
  output = ""
  results.forEach(async (block) => {   
    var b = await abc.parse(block)
    output += b


Use a standard for or for..of to loop over the list:

async function getData() {
  output = ""
  for (const block of results) {
    var b = await abc.parse(block)
    output += b

1007Regenerate Thumbnails in WordPress

Option 1

The Regenerate Thumbnails Plug-in.

Option 2

wp command line tool

Regenerate all images, without confirmation.

wp media regenerate --yes

Regenerate thumbnails only.

wp media regenerate --image_size=thumbnail


Error: Error establishing a database connection.

When working on localhost, use instead of localhost in wp.config

define( 'DB_HOST', '' );

1002Rename Branches on GitHub

Renaming a branch on Github is straight-forward:

The "Lean More" link has some instructions how to update the local environments:

Your members will have to manually update their local environments. We'll let them know when they visit the repository, or you can share the following commands.

git branch -m oldbranchname newbranchname
git fetch origin

Username for 'https://github.com': trembl
Password for 'https://trembl@github.com': 

I tried automatically to log-in with my GitHub Password.

remote: Support for password authentication was removed on 
August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-
authentication-requirements-for-git-operations/ for more information.


Get a Personal Access Token

Ok, we need a Personal Access Token instead of the password!

Go to github.com > Settings > Developer Settings > Personal access tokens, and generate a new token with full repo access.

Once we use the token instead of the password, it works.

git branch -u origin/main main
# Branch 'main' set up to track remote branch 'main' from 'origin'.
git remote set-head origin -a
# origin/HEAD set to main

999Running Repetitive Jobs on OSX

Traditionally Unix systems use crontab to schedule and run repetitive jobs, OSX uses launchd, an init and operating system service management daemon.

Here is a script that call my index.php every 120 seconds. (I am download snow webcams in the index.php.)

<?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">
  <string>Getting Snow Pictures</string>

In Xcode, the same script looks like this:


I made a couple of errors, trying to get the script to run.

  1. Permissions sudo chown <user>:staff org.trembl.snow.plist
    Incorrect permissions also cause the Load failed: 122: Path had bad ownership/permissions

  2. The name of the file and the Label need to match. org.trembl.snow and org.trembl.snow.plist

  3. The plist need to be placed into ~/Library/LaunchAgents.

  4. If your Program has arguments, they need to be specified in an array:

  5. Both strings need to be absolute. I got this error: Load failed: 122: Path had bad ownership/permissions, which was caused by only saying index.php instead of the whole absolute path.

  6. Use launchctl bootstrap and not the obsolete launchctl load.

  7. Launch with sudo launchctl bootstrap gui/`id -u` ~/Library/LaunchAgents/org.trembl.snow.plist

  8. Stop: sudo launchctl bootout gui/`id -u` ~/Library/LaunchAgents/org.trembl.snow.plist

997Flask – [Errno 48] Address already in use


Stopping the flask server with ⌃-Z (CRTL-Z), instead of the correct ⌃-C (CRTL-C), results in the server still bound to port 5000:

OSError: [Errno 48] Address already in use

Problem: After Flask crash, the port can still be occupied.


Check who is using port 5000

sudo lsof -i:5000
kill $PID
kill -9 $PID


[2]  + killed     flask run