Skip to content

Instantly share code, notes, and snippets.


Yorick Terweijden terwey

View GitHub Profile
terwey /
Last active Jul 21, 2020 — forked from pwnsdx/
Disable bunch of #$!@ in Catalina
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# sudo mount -uw /
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
terwey /
Created Jun 9, 2019
Squarespace hack for adding taxes in Javascript.

Squarespace hack for adding taxes in Javascript.

This allows for showing your local taxrate (as is mandatory in most EU countries) on the store without needing to set the entire site to include taxes (which would also calculate taxes for outside-EU).

Trick is to take your price including VAT (e.g. €50): 50 / 1.19 = 42.01 and use this amount in the Inventory. Configure the tax-rules to set 19% where applicable (shipping from Germany to e.g. Netherlands requires 19% VAT anyway to a private person) and set to 0% to countries non-EU.

The cart will then reflect the correct pricing, and with this snippet (Settings -> Advanced -> Code Injection) inside the Footer will fix the storefront too.

NB: Be sure to disable AJAX Loading, this can be found in Design -> Site Styles because else it'll only work on Refresh and not initial load. This is a known bug in Squarespace.

terwey /
Last active Jul 24, 2017
PHP mail with SMTP for Apache/nginx/etc


apt-get install msmtp

vim /etc/msmtprc

port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt 
View xorg.conf
# Xorg.conf config for dummy video driver
# For usage with for example TeamViewer on a machine without a monitor attached
# and you wanted more then just 1024x768 ;)
# Use at own risk, loosly based on info scattered around but these links really helped
# for the modelines (lot of trial and error to figure out which worked over Teamviewer and Xorg)
# sample config from xpra who seems to use the dummy driver a lot (thanks guys!)
Section "Device"
Identifier "dummy_videocard"
View fixshards.php
$helpopts = array(
'host:' => 'Host/IP of the Elasticsearch node that runs the REST API',
'port::' => '(optional) Port for the Elasticsearch node',
'node:' => 'Node name for the Elasticsearch Indice',
'pretend' => 'Show sample of the to be dispatched POST Data',
'help' => 'Shows the available options'
terwey / gist:0594905cd03e472679ff
Created Feb 19, 2015
PHP Imagick (ImageMagick) TIFF to JPG
View gist:0594905cd03e472679ff
// So ImageMagic is pretty cool, -but- it can sometimes consider a TIFF
// to be "metadata" that should be part of your thumbnailed JPG.
$Thumb = new \Imagick();
$Thumb->setResolution(72,72); // set the DPI of $Thumb to 72dpi, it's the WEB!
$data = file_get_contents('/data/some_image.jpg'); // secretly a TIFF pretending to be a JPG
// else make $data be something that came from curl_exec
$Thumb->setCompressionQuality(80); // you know, why have a 100compression quality thumbnail?
$Thumb->resampleImage(72,72,imagick::FILTER_UNDEFINED,1); // VERY IMPORTANT, without this it'll just "set" the DPI
View gist:cdfd063d09d5c5ab8981
This method sets the Description of a Location
@todo add fail callbock method and throw exception as notification
$(document).ready(function() {
$("a[data-role=updateLocationDescription]").click(function() {
var reference = $(this);
var form = $('form#update-location-description-form');
var anchorData = jQuery.parseJSON($(this).attr('data-json'));
terwey / PHP5.4 -
Created Sep 2, 2013
Ubuntu 10.04 Lucid upgrade PHP 5.3.2 to PHP 5.4.19-1 (+ Ioncube)
View PHP5.4 -

PHP 5.4 woes on Ubuntu 10.04 Lucid

So I was having an issue on a VPS I rent that it was on Ubuntu 10.04 LTS. They seem to have a different idea of what LTS means then what seems reasonable. Having your packages available for 5 years isn't something I'm waiting for, I can also still get Debian Buzz with no issues so that's not an argument. What I want is -support- for -updates- on an -existing- platform. Luckily, I don't have to travel far to the Ubuntu team to slap some sense in them because luckily people run their own PPA's that do compile software for existing OS installs.

However, I kept running into an issue that most posts and gists kept referring to PPA's that no longer supported Ubuntu 10.04 Lucid by now... Found a few PPA's but they named their packages like php54 and libapache2-mod-php54 which causes Ubuntu 10.04 Lucid with Plesk installed to throw you a giant headache cause it wants to remove Plesk specific packages (cause it's only compatible with libapache2-mod-php5 and php5)

Getting to i

terwey /
Last active Feb 1, 2017
Newscoop 4.2 - A Simple Plugin

Newscoop 4.2 - a Simple Plugin

Just like you I am extremely excited about the release of [Newscoop 4.2] and the new [Symfony Bundles] plugin system. In the following few steps I will demonstrate to you how to get started creating a super simple Plugin for [Newscoop 4.2].


  • Motivation (we won't get anywhere if you don't have this!)
  • Your favourite code editor
  • Git client
  • (S)FTP Client for connecting to your server
  • Some knowledge of how to use the Terminal
terwey / spicy_pretzel_pieces.txt
Last active Dec 15, 2015
Recipe for Spicy Pretzel Pieces PS: I live in Germany so getting 'Brezeln' is not so hard. These are basically the sourdough pretzels frozen ;)
View spicy_pretzel_pieces.txt
Spicy Pretzel Pieces
1 pack of fresh 'Brezeln', any brand will do.
240ml oil (I used sunflower)
1-2 teaspoons of Cayenne Pepper
2-3 dining spoons 'Kühne Schäfer Feuerig-Scharfe Chilisauce mit Habanero Chili'
1 envelope 'Knorr Salat Krönung Cremig "American"'