Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @file
* Definition of Drupal\Core\Cache\ArrayBackend.
*/
namespace Drupal\Core\Cache;
/**
@LionsAd
LionsAd / smartcache-plus-poc.diff
Created February 18, 2015 13:20
SmartCache++
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 69e99a0..8bdf86a 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -184,6 +184,11 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
$this->bubbleStack();
return $elements['#markup'];
}
+
+ // Store the cache ID for later comparison.
<?php
class BigPipeResponse extends StreamedResponse {
public function __construct(Response $response) {
$this->mainResponse = $response;
$this->setStatusCode($response->statusCode());
$this->headers->set($response->headers->all());
$this->mainBody = $response->getContent();
}
if (!"ggplot2" %in% rownames(installed.packages())) {
install.packages("ggplot2")
}
library("ggplot2")
args <- commandArgs(trailingOnly = TRUE)
before_file <- args[1]
after_file <- args[2]
@kennethreitz
kennethreitz / .aliases
Created April 25, 2010 20:38
My environment configuration
alias ports='sudo lsof -iTCP -sTCP:LISTEN -P'
alias dnsflush='dscacheutil -flushcache'
alias git-add='git add -A'
alias dmesg="sudo dmesg"
alias l='ls -lrtha'
alias dir='ls -lh'
alias svnscrub='find . -name .svn -exec rm -rf {} \;'
alias vpnfix='sudo route -nv add -net 10 -interface utun0 && sudo route change default 10.0.1.1'
alias gitx='/Applications/GitX.app/Contents/MacOS/GitX &'
@kkaefer
kkaefer / gist:646017
Created October 25, 2010 23:33
node.js proxy to enforce HTTPS and remove cookies
var http = require('http');
var secure = new RegExp('(' + [
'facebook.com',
'twitter.com',
'google.com'
].join('|').replace('.', '\\.') + ')$');
var noSecure = new RegExp('^(' + [
'http://(www\.)?google\.com/(image|imghp)',
@wimleers
wimleers / crontab
Created November 1, 2010 00:00
DriverPacks.net server crontab file
#
# Normal cronjobs.
# m h dom mon dow command
#
# Regenerate torrents.tar.gz every hour.
*/60 * * * * tar -cvzf /data/www/svn_driverpacks.net/files/torrents.tar.gz /data/www/svn_driverpacks.net/files/torrents/*.torrent
# Run DriverPacks CDN and seedbox rsync scripts (for downloads)
*/20 * * * * /home/wim/cronscripts/dps-cdn-rsync.sh
@wimleers
wimleers / dps-seedbox1-rsync.sh
Created November 29, 2010 12:01
Script that syncs a directory tree recursively to another server, to a single target ("flat") directory, using rsync.
#!/bin/sh
LOGFILE=/data/logs/dps-seedbox1-rsync/$(date "+%Y-%m").log
EXCLUDES_COMMON="--exclude lost+found --exclude .ssh --exclude .bash_history"
EXCLUDES_MORE="--exclude other --exclude BASE --exclude applications"
# Append a header first, so we know when this script was run.
date "+%n%n=====%nSyncing DriverPacks to seedbox1 at %Y-%m-%d %H:%M:%S" > $LOGFILE
# Sync the DriverPacks themselves to the seedbox' 'data' folder. However, we
@wimleers
wimleers / dps-s3-rsync.sh
Created January 20, 2011 10:49
Script that syncs a directory recursively to Amazon S3 using s3sync.
#!/bin/bash
export AWS_ACCESS_KEY_ID=yourID
export AWS_SECRET_ACCESS_KEY=yourSecret
export AWS_TARGET_BUCKET=DriverPacks_back-up
export AWS_TARGET_DIR=/
export SOURCE_DIR=/data/www/downlodsorigin.driverpacks.net/
export S3SYNC_DIR=/home/wim/scripts/s3sync
export SSL_CERT_DIR=/etc/ssl/certs
@wimleers
wimleers / mysql-slow-log-analytics.sh
Created April 26, 2011 22:28
Script to automatically analyze slow queries of last hour and last 24 hours, using mk-query-digest.
#!/bin/sh
INPUT=/var/log/mysql/mysql-slow.log
OUTPUT_1H=/data/www/wimleers.com/status/mysql-slow-1h.txt
OUTPUT_24H=/data/www/wimleers.com/status/mysql-slow-24h.txt
# Perform the analytics, overwriting the previous results.
../scripts/mk-query-digest --since 1h $INPUT > $OUTPUT_1H
../scripts/mk-query-digest --since 24h $INPUT > $OUTPUT_24H