Skip to content

Instantly share code, notes, and snippets.

View maximivanov's full-sized avatar

Max Ivanov maximivanov

View GitHub Profile
@maximivanov
maximivanov / gist:1ffc457e1b4fbd8a00d1c4c579d4596c
Created January 28, 2021 23:14
List all Terraform output names
terraform output 2>/dev/null | cut -d ' ' -f1
@maximivanov
maximivanov / ddev.sh
Last active January 15, 2021 12:50
Shell script shortcut to start a local dev container
#!/bin/bash
#
# Shortcut script to start Docker dev container in the current directory
#
# chmod+x ddev.sh
# ln -s ddev.sh /usr/local/bin/ddev
#
# Usage: ddev [-p port mapping] [-n container name]
# ddev -p 8080:8080 -n my-node-project
# ddev # container name defaults to the current directory
@maximivanov
maximivanov / sed-replace.sh
Created January 14, 2021 13:29
Replace multiple regular expressions with sed
#!/bin/bash
#
# Read file content, replace all occurences of multiple regex'es listed below, print result to the stdout
# Usage: ./sed-replace.sh FILENAME
# sed regex reference: http://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html#Regular-Expressions
#
# Example source.txt:
#
# lorem ipsum search 1 lorem
# lorem ipsum search 2 ending with number 5 lorem
@maximivanov
maximivanov / Dockerfile
Last active February 1, 2021 13:10
Utility Docker image to develop and deploy Azure Functions in Node.js with Terraform. zsh, ohmyzsh, powerlevel10k.
# Usage
# docker build -t maxivanov/az-dev-img - < Dockerfile
# docker run -it --rm maxivanov/az-dev-img
#
# az --version
# func --version
# node --version
# npm --version
# terraform --version
@maximivanov
maximivanov / gist:3f61626307f2f8cf5a9327e81c7d436b
Created January 10, 2021 14:59
Make graphql requests with curl
# GraphQL query
curl 'http://localhost:7071/graphql' \
-X POST \
-H 'content-type: application/json' \
--data '{
"query":"{ posts { id } }"
}'
# GraphQL mutation
curl 'http://localhost:7071/graphql' \
@maximivanov
maximivanov / gist:8bbca65f512997b963ff1274815479c2
Created January 10, 2021 14:38
Create a Node.js Azure Function app into the existing resource group, storage account, app service plan; skip creating an App Insights instance.
az functionapp create \
--resource-group proj-dev-resource-group \
--storage-account projdevstorage \
--plan proj-dev-app-service-plan \
--runtime node \
--runtime-version 12 \
--os-type Linux \
--functions-version 3 \
--name proj-dev-function-app \
--disable-app-insights true
@maximivanov
maximivanov / gist:8958787
Last active August 29, 2015 13:56
Trying to reproduce stackoverflow bug #21731881
curl -XPUT 'http://localhost:9200/test21731881/' -d '{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"my_ngram_analyzer" : {
"tokenizer" : "my_ngram_tokenizer"
}
},
"tokenizer" : {