Create Python virtual env
python3 -m venv v-env
Activate
""" | |
Send an Alert Event to PagerDuty | |
NOTE: "ALERT_ROUTING_KEY" environment variable must contain a | |
valid routing key for a PagerDuty service. | |
https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgw-events-api-v2-overview#getting-started | |
Usage: | |
$ python -m pd_alert "Alert Title" "Alert Body" "dedup_key" |
mutation updateUser( | |
details: UpdateUserInput! | |
): UpdateUserResult | |
union UpdateUserResult = | |
UpdateUserSuccess | | |
FormValidationError | |
type UpdateUserSuccess {} |
<?php | |
namespace App\Providers; | |
use Illuminate\Http\Request; | |
use Illuminate\Routing\Route; | |
use Illuminate\Support\ServiceProvider; | |
use App\Http\Middleware\CaptureRequestExtension; | |
class AppServiceProvider extends ServiceProvider |
<?php | |
namespace App\Commands\Database; | |
use Illuminate\Support\ServiceProvider; | |
class BindDatabaseServiceProvider extends ServiceProvider | |
{ | |
public function boot() | |
{ |
# This file is your Lambda function | |
import json | |
def mirror_query_strings(event, context): | |
body = { | |
"queryStrings": event['queryStringParameters'] | |
} | |
return { | |
"statusCode": 200, |
func init() { | |
rand.Seed(time.Now().UnixNano()) | |
} | |
func retry(attempts int, sleep time.Duration, f func() error) error { | |
if err := f(); err != nil { | |
if s, ok := err.(stop); ok { | |
// Return the original error for later checking | |
return s.error | |
} |
'Update or create a stack given a name and template + params' | |
from __future__ import division, print_function, unicode_literals | |
from datetime import datetime | |
import logging | |
import json | |
import sys | |
import boto3 | |
import botocore |
#!/bin/bash | |
BUCKET="YOUR_BUCKET_NAME" # bucket name | |
FILENAME="deployment-package.zip" # upload key | |
TMP_FOLDER="/tmp/lambda-env-tmp/" # will be cleaned | |
OUTPUT_FOLDER="/tmp/lambda-env/" # will be cleaned | |
HERE=${BASH_SOURCE%/*} # relative path to this file's folder | |
LAMBDA_FOLDER="$HERE/lambda/" # relative path |
# Image neeeds to have ssh-client | |
image: docker:git | |
services: | |
- docker:dind | |
stages: | |
- staging | |
before_script: | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY |