Skip to content

Instantly share code, notes, and snippets.

@Maks3w
Maks3w / OAuth2ServerFactoryCryptoToken.php
Created April 30, 2015 22:12
ZF2 OAuth2 with JWT AcessToken response type
<?php
namespace FooOAuth2\Factory;
use FooOAuth2\Storage\ClientCredentialsStorage;
use OAuth2\GrantType\ClientCredentials;
use OAuth2\GrantType\UserCredentials;
use OAuth2\ResponseType\JwtAccessToken as JwtAccessTokenResponseType;
use OAuth2\Server as OAuth2Server;
use OAuth2\Storage\JwtAccessToken as JwtAccessTokenStorage;

Keybase proof

I hereby claim:

  • I am maks3w on github.
  • I am maks3w (https://keybase.io/maks3w) on keybase.
  • I have a public key whose fingerprint is ABE3 86A0 E299 AD22 50D9 3DF0 C194 028A D695 06E3

To claim this, I am signing this object:

@Maks3w
Maks3w / FailedValidation.php
Created October 8, 2015 12:37
Conditional require fields on Apigility
<?php
namespace Application\Problem;
use ZF\ApiProblem\ApiProblem;
/**
* Represent a Failed Validation API Problem.
*
* This Problem must be used only when the failure is specific to one or many fields.
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ZendTest\Serializer\Adapter;
use Zend\Json\Encoder;
import {Directive, forwardRef, Provider} from "angular2/core";
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from "angular2/common";
import {CONST_EXPR} from "angular2/src/facade/lang";
const FILE_VALUE_ACCESSOR = CONST_EXPR(
new Provider(NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => FileControlValueAccessor), multi: true})
);
/**
* The accessor for listening to changes that is used by the
@Maks3w
Maks3w / ssh.sh
Last active February 14, 2021 20:46
This script locate and SSH into an EC2 instance executing the given ECS service
#!/usr/bin/env bash
if [[ $# -lt 2 ]]; then
echo "Invalid arguments $0 <cluster> <service>"
exit 1
fi
cluster=$1
service=$2
@Maks3w
Maks3w / terraform_coding-style.yml
Created May 23, 2020 12:06
GitHub Action for Terraform Coding Style fixes automatization
name: Terraform Coding Style fixer
description: 'Terraform Coding Style fixer creates a Pull Request with the suggested Coding Style fixes'
on: push
jobs:
terraform-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:

Both things have been introduced recently, and let you access even private ec2 instances

  1. Without VPN
  2. No open SSH port
  3. Authentication / Authorization is fully delegated to IAM
# Assumes valid AWS Credentials in ENV