Skip to content

Instantly share code, notes, and snippets.

View MEGApixel23's full-sized avatar
🌴

Igor Omelchenko MEGApixel23

🌴
View GitHub Profile
@johnestima
johnestima / cognito-delete-all-users.sh
Created August 21, 2020 17:21
Cognito delete all users from user pool
#!/bin/bash
USER_POOL_ID=POOL_ID
RUN=1
until [ $RUN -eq 0 ] ; do
echo "Listing users"
USERS=`aws cognito-idp list-users --user-pool-id ${USER_POOL_ID} | grep Username | awk -F: '{print $2}' | sed -e 's/\"//g' | sed -e 's/,//g'`
if [ ! "x$USERS" = "x" ] ; then
for user in $USERS; do
@daniel-cortez-stevenson
daniel-cortez-stevenson / elasticsearch-service-template.yaml
Last active December 15, 2023 09:50
AWS ElasticSearch Domain with VPC and Bastion Cloudformation Template
# Copyright 2020 Daniel Cortez Stevenson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@nicksheffield
nicksheffield / timeslots-generator.js
Created February 17, 2020 02:49
Generate an array of time slots from a beginning to an end, skipping forward a certain amount of time each time
import { isBefore, setHours, setMinutes, setSeconds, addMinutes, setMilliseconds } from 'date-fns'
const setTime = (x, h = 0, m = 0, s = 0, ms = 0) => setHours(setMinutes(setSeconds(setMilliseconds(x, ms), s), m), h)
const from = setTime(new Date(), 9)
const to = setTime(new Date(), 17)
const step = (x) => addMinutes(x, 30)
const blocks = []
let cursor = from
@dankochetov
dankochetov / build.sh
Last active April 16, 2020 08:54
CI script for frontend
#!/usr/bin/env bash
# Enable commands logging
PS4="> "
set -x
set -e
if ! [[ -x "$(command -v pip3)" ]]; then
apt-get update && apt-get install -y python3-pip
@sploders101
sploders101 / fileDrop.vue
Last active September 17, 2023 15:25
Vuetify file drop box (drag-n-drop enabled, no directory support, uses vuetify-loader)
<template>
<!-- Drop box -->
<div class="dropzone"
@dragover.prevent
@dragleave="dragleave"
@dragenter="dragenter"
@drop="drop"
ref="dropzone"
>
<!-- Box Label -->
@koingdev
koingdev / putitem-if-not-exist.vtl
Created July 22, 2019 09:41
AppSync Resolver PutItem with Condition Prevent Data Overwrite
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"shopID": $util.dynamodb.toDynamoDBJson($ctx.args.shopID),
"vendorID": $util.dynamodb.toDynamoDBJson($ctx.args.vendorID)
},
"attributeValues": {
"name": $util.dynamodb.toDynamoDBJson($ctx.args.name)
},
DaxIamRole:
Type: AWS::IAM::Role
Properties:
RoleName: ${self:service.name}dax
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
@Dineshkarthik
Dineshkarthik / dynamodb_replicate_table.py
Last active June 20, 2021 10:27
Copy dynamoDB table to another region using python, boto3. This script creates an exact replica of the table with same key schema and attribute definitions.
# Copyright (C) 2018 Dineshkarthik Raveendran
from __future__ import print_function # Python 2/3 compatibility
import boto3
import argparse
def replicate(table_name, existing_region, new_region, new_table_name):
"""
Replicate table in new region.
@visitdigital
visitdigital / encrypt-with-zapier-code-app.js
Last active September 9, 2022 11:13
Encrypt data with Zapier using Zapier Code App
var crypto = require("crypto")
function encrypt(key, data) {
var cipher = crypto.createCipher('aes-256-cbc', key);
var crypted = cipher.update(data, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
var key = "supersecretkey";
@seeebiii
seeebiii / LambdaConstants.java
Last active October 24, 2024 15:44
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10