Skip to content

Instantly share code, notes, and snippets.

View mauricios's full-sized avatar
🎯
Focusing

Mauricio Sánchez mauricios

🎯
Focusing
View GitHub Profile
@mauricios
mauricios / LoginService.php
Last active September 8, 2016 16:23
eZ Platform Service to login user programatically
<?php
namespace Vendor\MyLoginBundle\Services;
use Symfony\Component\HttpFoundation\RequestStack,
Symfony\Component\HttpFoundation\Response,
Symfony\Component\HttpFoundation\Cookie;
class LoginService
{
@mauricios
mauricios / varnish_vcl_remove_cookies.vcl
Created June 30, 2016 20:35
Varnish 3 VCL to make cache removing cookies
backend default {
.host = "localhost";
.port = "8080";
}
sub vcl_recv {
set req.backend = default;
if (req.url !~ "(/admin)") {
unset req.http.cookie;
@mauricios
mauricios / swapfile.sh
Last active November 10, 2016 15:39
Creates a Swap file in Ubuntu 14.04, useful for increase memory in virtual machines
#!/bin/sh
# Creates swap file
sudo dd if=/dev/zero of=/swapfile bs=1G count=1 &&
sudo chmod 600 /swapfile &&
sudo mkswap /swapfile &&
sudo swapon /swapfile;
# Remove swap file
sudo swapoff /swapfile &&
@mauricios
mauricios / s3fs-iam-bucket-policy.json
Last active February 25, 2019 18:24
AWS IAM Policy to access an S3 bucket from s3fs
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets"
],
"Resource": [
"arn:aws:s3:::my-bucket"