Skip to content

Instantly share code, notes, and snippets.

View carlossosa's full-sized avatar

Carlos Sosa carlossosa

View GitHub Profile
@carlossosa
carlossosa / Configuration.php
Created August 5, 2022 12:38 — forked from xphere/Configuration.php
Recursive symfony/configuration
<?php
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Helper function to create recursive nodes
*/
function recursiveNode(string $name, callable $callback)
@carlossosa
carlossosa / App\Command\System\CreateMongoEncryptKeyCommand.php
Last active August 5, 2022 16:15
Symfony 5.4/DoctrineMongoDBBundle 4.4: Workaround to pass $driver_options["autoEncryption" ] to MongoDB\Client
<?php
namespace App\Command\System;
use MongoDB\Client;
use Symfony\Bundle\FrameworkBundle\Secrets\AbstractVault;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@carlossosa
carlossosa / Customer.php
Created August 17, 2021 01:38 — forked from webdevilopers/Customer.php
Using event subscriber to get MongoDB ODM Documents related to ORM Entity in Doctrine
<?php
/**
* @ORM\Entity()
* @ORM\EntityListeners({"Acme\AppBundle\Event\CustomerListener"})
*/
class Customer()
{
}
@carlossosa
carlossosa / using-aws-kms.php
Created July 22, 2018 12:52 — forked from lysender/using-aws-kms.php
Using AWS KMS API via PHP SDK
<?php
use Aws\Kms\KmsClient;
// Somewhere in the controller or model
$this->load->config('aws');
// Not needed for EC2 instance role based authorization - for my local instance only
$key = $this->config->item('aws_s3_access_key');
$secret = $this->config->item('aws_s3_secret_key');
@carlossosa
carlossosa / json.lua
Created March 24, 2018 21:16 — forked from tylerneylon/json.lua
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@carlossosa
carlossosa / IAM_Role.json
Created July 29, 2017 12:41 — forked from daviddyball/IAM_Role.json
EC2 Metadata Script to Load a bootstrap script from S3 based on EC2 Tag Definitions
{
"Statement": [
{
"Sid": "EC2DescribeInstances",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeTags"
],
"Resource": [