This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\EdgestashBundle; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
use Twig\Extension\AbstractExtension; | |
use Twig\TwigFilter; | |
use Twig\TwigFunction; | |
class TwigExtension extends AbstractExtension | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\EdgestashBundle\EventSubscriber; | |
use Symfony\Component\EventDispatcher\Event; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpKernel\Event\FilterResponseEvent; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
class EdgestashSubscriber implements EventSubscriberInterface | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.1; | |
import cookieplus; | |
import edgestash; | |
import std; | |
import ykey; | |
import redis; | |
import synthbackend; | |
backend default { | |
.host = "origin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Redis VMOD and strings containing NULL chars" | |
shell { | |
python - <<EOF | |
import base64 | |
import redis | |
b64 = 'X3NmMl9hdHRyaWJ1dGVzfGE6Mjp7czo1OiJsaWtlZCI7YTowOnt9czoxNDoiX3NlY3VyaXR5X21haW4iO3M6OTAzOiJDOjc0OiJTeW1mb255XENvbXBvbmVudFxTZWN1cml0eVxDb3JlXEF1dGhlbnRpY2F0aW9uXFRva2VuXFVzZXJuYW1lUGFzc3dvcmRUb2tlbiI6ODE1OnthOjM6e2k6MDtOO2k6MTtzOjQ6Im1haW4iO2k6MjthOjQ6e2k6MDtPOjQxOiJTeW1mb255XENvbXBvbmVudFxTZWN1cml0eVxDb3JlXFVzZXJcVXNlciI6Nzp7czo1MToiAFN5bWZvbnlcQ29tcG9uZW50XFNlY3VyaXR5XENvcmVcVXNlclxVc2VyAHVzZXJuYW1lIjtzOjU6InRoaWpzIjtzOjUxOiIAU3ltZm9ueVxDb21wb25lbnRcU2VjdXJpdHlcQ29yZVxVc2VyXFVzZXIAcGFzc3dvcmQiO3M6NjA6IiQyeSQxMiQxaUVVNVJ0REZUQkptMGhocXpZR2NPamdSTFhXUGlPQjYzS2VFVVhNNXA5bFFLejlFeklUQyI7czo1MDoiAFN5bWZvbnlcQ29tcG9uZW50XFNlY3VyaXR5XENvcmVcVXNlclxVc2VyAGVuYWJsZWQiO2I6MTtzOjYwOiIAU3ltZm9ueVxDb21wb25lbnRcU2VjdXJpdHlcQ29yZVxVc2VyXFVzZXIAYWNjb3VudE5vbkV4cGlyZWQiO2I6MTtzOjY0OiIAU3ltZm9ueVxDb21wb25lbnRcU2VjdXJpdHlcQ29yZVxVc2VyXFVzZXIAY3JlZGVudGlhbHNOb25FeHBpcmVkIjtiOjE7czo1OToiAFN5bWZvbnlcQ29tcG9uZW50XFN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"strconv" | |
"net/http" | |
"github.com/zenazn/goji" | |
"github.com/zenazn/goji/web" | |
"os/exec" | |
"encoding/json" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function start(Request $request, AuthenticationException $authException = null) | |
{ | |
$jwtPayload = $this->getJwtPayload($request->cookies->get('token')); | |
if(isset($jwtPayload['sub'])) { | |
return new Response("Don't wanna to this, really. The actual protected page should show up instead"); | |
} | |
return new RedirectResponse($this->router->generate('login')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import std; | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.max_connections = 300; | |
.first_byte_timeout = 100s; | |
.connect_timeout = 10s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import std; | |
backend default { | |
.host = "176.62.169.146" ; | |
.port = "80"; | |
} | |
acl purge { | |
"127.0.0.1"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addDateBeforeFirstParagraph($content) { | |
if(!is_singular('post')) return $content; | |
$closing_p = '<p>'; | |
$paragraphs = explode( $closing_p, $content ); | |
foreach ($paragraphs as $index => $paragraph) { | |
if ( trim( $paragraph ) ) { | |
$paragraphs[$index] .= $closing_p; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:6.9.2 | |
EXPOSE 8080 | |
COPY server.js . | |
CMD node server.js |