Skip to content

Instantly share code, notes, and snippets.

View cagataygurturk's full-sized avatar

Çağatay Gürtürk cagataygurturk

View GitHub Profile
@cagataygurturk
cagataygurturk / gcp.js
Created February 23, 2020 19:06
Invoking Cloud Function
const url = 'https://REGION-HOST_PROJECT_ID.cloudfunctions.net/FUNCTION_NAME';
const targetAudience = url;
const {GoogleAuth} = require('google-auth-library');
const auth = new GoogleAuth();
async function request() {
 const client = await auth.getIdTokenClient(targetAudience);
 const res = await client.request({url});
 console.info(res.data);
}
request().catch(err => {
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ResourceRegion:
Type: String
Description: The region where the resource to be allowed is deployed
Default: eu-west-1
ResourceVpcId:
Type: String
Description: The VPC ID where the resource to be allowed is deployed
Conditions:
$(function ($) {
var scanInterval = 2000;
if(typeof window.performance.getEntriesByType === 'undefined') return;
var alreadyLoggedResources = {};
var logHttpResource = function(resourceName) {
if(alreadyLoggedResources.hasOwnProperty(resourceName)) {
return;
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"DomainName": {
"Description": "Domain name you want to redirect (without www)",
"Type": "String"
},
"HostedZoneId": {
"Type": "AWS::Route53::HostedZone::Id",
"Description": "Route53 Hosted Zone Id that your domain is served in"
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ResourceRegion:
Type: String
Description: The region where the resource to be allowed is deployed
Default: eu-west-1
ResourceVpcId:
Type: String
Description: The VPC ID where the resource to be allowed is deployed
Conditions:
/**
* This lambda function creates the necessary security group for Cloudfront
*/
const Region = '${ResourceRegion}'; //Hardcoded on Cloudformation template
const VpcId = '${ResourceVpcId}'; //Hardcoded on Cloudformation template
const AWS = require('aws-sdk');
const GroupName = 'Cloudfront-SecurityGroup';
const topicArn = 'arn:aws:sns:us-east-1:806199016981:AmazonIpSpaceChanged';
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"s3:*",
"lambda:*",
"execute-api:*",
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"s3:*",
"lambda:*",
"execute-api:*",
@GET
@Path("/helloworld/{id}")
public Response indexEndpoint(@PathParam int id) {
return Response.status(200).entity("Hello world: " + id).build();
}
<?php
public function onBootstrap(EventInterface $e){
$em = $e->getApplication()->getEventManager();
$em->attach(MvcEvent::EVENT_ROUTE, array(
$this,
'detachNotFoundStrategy'
) , 1);
}