This file contains hidden or 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
import argparse | |
import yaml | |
import boto3 | |
CLOUDFORMATION = boto3.client("cloudformation") | |
def main(): | |
parser = argparse.ArgumentParser(prog="convert_parameters") |
This file contains hidden or 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
def paginate(method, **kwargs): | |
client = method.__self__ | |
paginator = client.get_paginator(method.__name__) | |
for page in paginator.paginate(**kwargs).result_key_iters(): | |
for result in page: | |
yield result | |
# usage: | |
import boto3 |
This file contains hidden or 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
import botocore.session | |
from botocore.credentials import ( | |
AssumeRoleCredentialFetcher, | |
DeferredRefreshableCredentials, | |
) | |
import boto3 | |
def get_boto3_session(assume_role_arn=None): | |
session = boto3.Session() |
This file contains hidden or 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
build_image: | |
image: docker:git | |
services: | |
- docker:dind | |
script: | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com | |
- docker pull registry.gitlab.com/[username]/[project-name]:latest | |
- docker build -t registry.gitlab.com/[username]/[project-name] . | |
- docker push registry.gitlab.com/[username]/[project-name]:latest | |
only: |
This file contains hidden or 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 AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* Class Campaign | |
* @package AppBundle\Entity |
This file contains hidden or 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 | |
use Symfony\Component\PropertyAccess\PropertyAccess; | |
function getData($items, $columns) { | |
$accessor = PropertyAccess::createPropertyAccessor(); | |
$rows = array(); | |
foreach ($items as $item) { | |
$rows[] = array_map(function ($path) use ($item, $accessor) { |
This file contains hidden or 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 | |
use Symfony\Component\Process\Process; | |
$process = new Process('svn2git ' . $svnHref); | |
$process->setTimeout(3600); | |
$process->run(function ($type, $buffer) { | |
if (Process::ERR === $type) { | |
$output->write('<error>' . $buffer . '</error>'); | |
} else { |
This file contains hidden or 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 | |
// building from the last example... | |
use Symfony\Component\Finder\Finder; | |
$finder = Finder::create() | |
->files() | |
->in(__DIR__ . DIRECTORY_SEPARATOR . 'Command') | |
->name('*Command.php'); |
This file contains hidden or 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 | |
$loader = require(__DIR__.'/vendor/autoload.php'); | |
// Do some bootstrapping of your application | |
use Symfony\Component\Console\Application; | |
$application = new Application; | |
$application->add(new \MyProject\Command\SomeCommand); |
This file contains hidden or 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 | |
class DefaultController extends Controller | |
{ | |
/** | |
* Dashboard page. | |
* @Permissions(perm="dashboard_view") | |
* @Route("/", name="ITEDashboardBundle_index") | |
* @Template() | |
* @return array |