Skip to content

Instantly share code, notes, and snippets.

@rodrigodiez
rodrigodiez / main.tf
Created April 23, 2020 08:34
Terraform code to configure ALB listener rules with OIDC authentication with one app per route
variable "aws_lb_listener_arn" {
description = "ARN of the ALB listener to include rules into"
type = "string"
}
variable "okta_auth_server_base_url" {
description = "Base URL of Okta's authorization server"
type = "string"
}
<?php
namespace App\Logger\Processor;
use Symfony\Component\HttpFoundation\RequestStack;
class RequestIdProcessor
{
private $requestStack;
# Granada
# Almeria
# Murcia
## Manga del mar menor
### Donde dormir
- [Post](https://www.furgoneteo.com/donde-pernoctar-en-el-mar-menor-furgoperfectos/) y [mapa](https://www.google.com/maps/d/u/0/embed?authuser=0&mid=1Ng4YeNRFjHfcuaeXmfwdT44M2Ok) de un blog de furgoneteros con sitios recomendados
- [Camping Caravaning](http://www.caravaning.es/es) para coger fuerzas
- Faro de Cabo de Palos: El mas familiar y seguro. Y con chiringuito!
### Playas:
- Cala Reona
<?php
class FooService
{
protected $container;
public function __construct(Symfony\Component\DependencyInjection\Container $container)
{
$this->container = $container;
}
@rodrigodiez
rodrigodiez / Redis flood control
Last active December 20, 2015 15:39
Redis flood control
// Primer intento 10:00 AM
> SETEX users:1:comments:attempts:27664A7l 300 fooValue
// Segundo intento 10:01 AM
> SETEX users:1:comments:attempts:lh70Qnvh 300 fooValue
// Tercer intento 10:02 AM
> SETEX users:1:comments:attempts:f2F5mNjl 300 fooValue
@rodrigodiez
rodrigodiez / CommentListener.php
Last active December 20, 2015 15:39
Example of flood control using REDIS (Predis vía Symfony SNCRedisBundle)
<?php
namespace Foo/Bar/Event/Observer/CommentSubscriber;
// ...
// Use statements, constructor, boring code...
// ...
// Our callable wich listen for new comment attempt
public function onNewComment(FilterCommentEvent $event)
@rodrigodiez
rodrigodiez / gist:4753926
Created February 11, 2013 11:18
Create a swap space into an Amazon EC2 Micro instance in order to prevent memory exceptions
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@rodrigodiez
rodrigodiez / Acme\Bundle\Controller\DefaultController.php
Created January 22, 2013 18:38
Feedback message system to store messages on users session and show them on templates. Flash messages and persistent ones, two implementations. It works. Maybe this Gist would rise some errors because of the changes the code needed to make it public. Hope no security holes. Enjoy!
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/