Skip to content

Instantly share code, notes, and snippets.

@adamjakab
adamjakab / ckeditor.inc
Created December 9, 2015 14:48
WYSIWYG - fix CKEditor version(4+) check
if (preg_match('@version:[\'"](?:CKEditor )?([\d\.]+)(?:.+revision:[\'"]([\d]+))?@', $line, $version)) {
<?php
/**
* Product Main Page
*/
/** @var Array $TV - TemplateVariables - All defined variables in this template file */
$TV = get_defined_vars();
/*
<div id="node-<?php print $TV["nid"]; ?>" class="<?php print $TV["classes"]; ?> product-full clearfix"<?php print $TV["attributes"]; ?>>
<div class="row"<?php print $TV["content_attributes"]; ?>>
@adamjakab
adamjakab / 66e3cbf00b3e0d06b59f62d84f643729
Created June 11, 2015 10:04
tmp preset config for d7
preset:
title: Mekit - Minimal
description: A minimal installation preset just like D7's original
modules: ~
themes: ~
libraries: ~
configuration:
form:
site_information:
site_name:
#!/bin/bash
mkdir ~/outlook
#File selection
readpst -o ~/outlook -r `zenity --file-selection`
find ~/outlook -type d | tac | grep -v '^~/outlook$' | xargs -d '\n' -I{} mv {} {}.sbd
# Create a new Token
curl -u 'githubuser' -d '{"note":"Your Application"}' https://api.github.com/authorizations
# It is: "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210"
#{
# "created_at": "2013-01-04T18:00:28Z",
# "app": {
# "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
@adamjakab
adamjakab / cpumon
Created November 24, 2014 12:08
Centos cpumon service (chkconfig compatible)
#!/bin/bash
#
# Author: Adam Jakab
#
# chkconfig: - 90 12
# description: CPU monitoring service with custom script
# processname: cpumon.sh
# pidfile: /var/run/cpumon.pid
#
@adamjakab
adamjakab / recoverSystem.sh
Created November 24, 2014 12:07
Recovery script
#!/bin/bash
#
# Author: Adam Jakab
# Description:
# 1) Shuts down critical services(httpd,mysql)
# 2) Attempts the recovery of damaged mysql database files
# 3) Restarts services
#
# Command to use to start/stop services
@adamjakab
adamjakab / cpumon.sh
Created November 24, 2014 12:07
Main cpu monitoring script
#!/bin/bash
#
# Author: Adam Jakab
# Description: Monitors CPU load and executes external script on exceeded treshold.
#
# Log file
LOGFILE="/var/log/cpumon/cpumon.log"
# Define Threshold
@adamjakab
adamjakab / AgentsHelperphp
Created November 6, 2014 08:21
Helper function to render agents
function getContactDataFor($id, $userType) {
$answer = array();
global $AZCOMP_CORE;
$db = $AZCOMP_CORE->get('_jdb');
$sql = 'SELECT res.*'
.' FROM #__dierre_agenti AS res'
.' WHERE res.id = ' . $id
.'';
$db->setQuery($sql);
$row = $db->loadObject();

Nginx FastCGI cache

Example /etc/nginx/nginx.conf using FastCGI (e.g. to PHP-FPM) with FastCGI cache enabled. This will capture returned data and persist it to a disk based cache store for a configurable amount of time, great for robust full page caching.

Will need to create a directory to hold cache files, for the example given here that would be:

$ sudo mkdir -p /var/cache/nginxfastcgi
$ chown www-data: /var/cache/nginxfastcgi