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
import os | |
import boto3 | |
import json | |
import botocore.auth | |
import botocore.credentials | |
from botocore.awsrequest import AWSRequest | |
from botocore.endpoint import BotocoreHTTPSession | |
from botocore.auth import SigV4Auth | |
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
#!/usr/bin/python | |
import boto3 | |
import sys | |
import os | |
from operator import itemgetter | |
def main(listener_arn): | |
client = boto3.client('elbv2') |
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
#!/usr/bin/env python3 | |
# How to use: | |
# | |
# LE_HOSTED_ZONE=XXXXXX LE_AWS_PROFILE=dns-access ./letsencrypt.sh --cron --domain example.org --challenge dns-01 --hook /tmp/hook-dns-01-lets-encrypt-route53.py | |
# | |
# More info about letsencrypt.sh: https://github.com/lukas2511/letsencrypt.sh/wiki/Examples-for-DNS-01-hooks | |
# Using AWS Profiles: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles | |
# Obtaining your Hosted Zone ID from Route 53: http://docs.aws.amazon.com/cli/latest/reference/route53/list-hosted-zones-by-name.html |
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
def handler_pre_dispatch(handler): | |
""" | |
Request decorator to convert APIG Proxy params to the old style | |
Merge GET, POST, STAGE into new event dict | |
:param handler: resource handler | |
:return: | |
""" | |
def request_decorator(event, content): | |
event_decorated = {} |
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
git branch -vv | grep ": gone]" | awk '{ print $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
<?php | |
/** | |
* Do an opposite of what array_dot does | |
* | |
* @param array $array | |
* @param string $delimiter | |
* @return array "undotted" nested array | |
*/ | |
function array_undot(array $array, $delimiter = '.') |
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
// moving 71b8026 from features/project-part-2 to features/project-part-1 | |
git checkout features/project-part-2 | |
git revert 71b8026 | |
// for sanity check can run git diff to between branched for particular file(s) | |
git difftool features/project-part-2..features/project-part-1 -- ./website/app/controllers/ExampleController.php | |
git push origin features/project-part-2 | |
git checkout features/project-part-1 | |
git cherry-pick 71b8026 |
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 Acme\DemoBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Security\Core\Role\SwitchUserRole; |
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 Interprac\Bundle\UtilityBundle\Form; | |
use Symfony\Component\Form\Form; | |
class FormErrors | |
{ | |
public function getArray(Form $form, $style = 'KO') | |
{ |
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 | |
function array_to_tree(array $array, $parent_id = 0) | |
{ | |
$array = array_combine(array_column($array, 'id'), array_values($array)); | |
foreach ($array as $k => &$v) { | |
if (isset($array[$v['parent_id']])) { | |
$array[$v['parent_id']]['children'][$k] = &$v; | |
} |
NewerOlder