Skip to content

Instantly share code, notes, and snippets.

View terwey's full-sized avatar
👋
Available for Hire

Yorick Terweijden terwey

👋
Available for Hire
  • Y Terweijden IT Advice
  • Berlin
View GitHub Profile
/*
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
terwey / gist:4723764
Last active December 12, 2015 05:48
NewzNab is very slow with innodb_flush_log_at_trx_commit = 1; I've seen extremely slow commits from Newznab and decided to take a look. I went from crawling slow to blazingly fast with simply turning this on. Now ok in case of a crash/fire etc your data might be lost or whatever. But this is not important data...
# mysql -u YOURUSER -p
mysql> SET GLOBAL innodb_flush_log_at_trx_commit = 0;
# add this to your /etc/mysql/my.cnf
# innodb_flush_log_at_trx_commit = 0;
# to make this permanent
@terwey
terwey / update_releases.patch
Created February 7, 2013 02:04
NewzNab's update_releases patch to increase the speed for Stage 7 Apply with: patch -p0 < update_releases.patch
Index: www/lib/releases.php
===================================================================
1492c1492
< if (preg_match("/\*$/i", $regexrow["groupname"]))
---
> if ('*' == substr($regexrow["groupname"], -1)) // twisted // if (preg_match("/\*$/i", $regexrow["groupname"]))
1603a1604
>
1905a1907
> /*
@terwey
terwey / spicy_pretzel_pieces.txt
Last active December 15, 2015 10:19
Recipe for Spicy Pretzel Pieces PS: I live in Germany so getting 'Brezeln' is not so hard. These are basically the sourdough pretzels frozen ;)
Spicy Pretzel Pieces
Pretzels:
1 pack of fresh 'Brezeln', any brand will do.
Marinade:
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"'
@terwey
terwey / PHP5.4 - Ubuntu-Lucid.md
Created September 2, 2013 19:33
Ubuntu 10.04 Lucid upgrade PHP 5.3.2 to PHP 5.4.19-1 (+ Ioncube)

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

<?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
terwey / part1.md
Last active February 1, 2017 22:31
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].

Prerequisites

  • 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
terwey / readme.md
Last active July 24, 2017 15:29
PHP mail with SMTP for Apache/nginx/etc

Setup

apt-get install msmtp

vim /etc/msmtprc

defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt 
@terwey
terwey / readme.md
Created June 9, 2019 12:19
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
terwey / disable.sh
Last active July 21, 2020 10:39
Disable bunch of #$!@ in Catalina
#!/bin/bash
# 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/disable.sh
# 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