Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View me2resh's full-sized avatar
🐪

Ahmed me2resh

🐪
View GitHub Profile
@me2resh
me2resh / solus-oh-my-zsh-theme.png
Created April 27, 2020 03:43 — forked from cloudnull/solus-oh-my-zsh-theme.png
Solus zsh theme for oh-my-zsh
solus-oh-my-zsh-theme.png
@me2resh
me2resh / lambda_provisioned_concurrency.yaml
Created December 4, 2019 23:48
How to use lambda provisioned concurrency in aws sam
Parameters:
FnName:
Type: String
ProvisionedConcurrency:
Type: String
Default: 10
EnableAliasProvisionedConcurrency:
Type: String
AllowedValues:
- true
@me2resh
me2resh / replace_multiple_words.js
Last active May 30, 2022 13:39
Replace multiple substrings in a string using reducer
const originalString = "I would love to eat apple and banana."
const wordsMap = {
'apple' : "mango",
'banana' : "grapes",
}
const replaceStrings = (value) => {
return Object.keys(wordsMap).reduce((result, oldString) => result.replace(new RegExp(oldString, 'g'), wordsMap[oldString]), value)
}
@me2resh
me2resh / serviceInterface.go
Last active September 26, 2019 16:51
Getting Service Struct by a JSON field
// Demo link https://play.golang.org/p/J-n45Ddk_Mf
package main
import (
"encoding/json"
"fmt"
)
type ServiceTypeHelper struct {
@me2resh
me2resh / attach_event_to_bucket_in_different_stack.sh
Last active August 24, 2019 22:41
Attach Event to a bucket in a different stack, Sometimes you need to attach an event to a bucket that don't exist in your project stack, You can run this shell script to achieve that
#!/bin/bash
# Get function ARN from stack
FUNCNAME="MyFunctionName"
FUNCARN=$(aws cloudformation describe-stacks \
--stack-name "Stack-Name" \
--query "Stacks[0].Outputs[?OutputKey==${FUNCNAME}].OutputValue" --output text
)
echo $FUNCARN
@me2resh
me2resh / sam_template_api_gateway_AWS_IAM_authorizer.yaml
Last active August 24, 2019 22:40
SAM Template for creating API Gateway with AWS_IAM authorizer
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
go-sam-bootstrap
SAM Template for creating API Gateway with AWS_IAM authorizer
##### Lambda Fuctions #####
Resources:
MyApi:
@me2resh
me2resh / presign_api_gateway_requests.php
Last active August 24, 2019 22:40
How to pre-sign AWS API gateway requests invoking lambdas
<?php
use Aws\Credentials\Credentials;
use GuzzleHttp\Psr7\Request;
use Aws\Signature\SignatureV4;
use Aws\Sts\StsClient;
use GuzzleHttp\Client;
/**
* Sandbox is IAM profile with the user permissions to:
* 1- execute-api:Invoke against the API Gateway resource
@me2resh
me2resh / .bash_profile
Last active September 16, 2015 07:42 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management