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
@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 / 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 / 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

/*
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:0594905cd03e472679ff
Created February 19, 2015 11:14
PHP Imagick (ImageMagick) TIFF to JPG
// 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->readImageBlob($data);
$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
<?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'
);
# 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
# http://arachnoid.com/modelines/ for the modelines (lot of trial and error to figure out which worked over Teamviewer and Xorg)
# https://www.xpra.org/xorg.conf sample config from xpra who seems to use the dummy driver a lot (thanks guys!)
Section "Device"
Identifier "dummy_videocard"
@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