Skip to content

Instantly share code, notes, and snippets.

View dobeerman's full-sized avatar
🤔
I may be slow to respond.

Alexander Smirnoff dobeerman

🤔
I may be slow to respond.
View GitHub Profile
@dobeerman
dobeerman / bitbucket-pipelines.yml
Created November 22, 2022 10:46
bitbucket | ECR deployment
pipelines:
custom: # Pipelines that can only be triggered manually
from-commit:
- step:
#python image with aws-cli installed
image: atlassian/pipelines-awscli
services:
- docker
script:
# aws login
@dobeerman
dobeerman / README.md
Created October 9, 2022 09:48 — forked from dkurzaj/README.md
Docker compose Kafka, Zookeeper and Kafka manager

Docker compose Kafka, Zookeeper and Kafka manager

Gist inspired by this one intending to be an updated version of it : https://gist.github.com/17twenty/d619f922ab209f750630824f7c6836e3

Install

  • Create the environment variable that contains our host name (IP address) :
$ export EXPOSED_HOSTNAME=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/')
  • Create the folders :
@dobeerman
dobeerman / main.dart
Last active May 25, 2022 18:36
Dart: Highlight substring widget
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
class TreeNode {
public value: number;
public left!: TreeNode;
public right!: TreeNode;
constructor(value: number) {
this.value = value;
}
}
@dobeerman
dobeerman / dispenseBanknotes.ts
Created August 10, 2021 05:15
The code demonstrates an elegant solution to a money dispensing machine problem.
/**
* Say, a customer requires $247 from an ATM machine.
* What is the combination of bank notes ($100, $50, $20, $10, $5, $1)
* that satisfies that request?
*/
class RequestBill {
private pairs: number[][];
constructor(private amount: number) {
this.pairs = [];
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: HTTP API to EventBridge with Custom Domain
Parameters:
DomainName:
Type: String
Description: Domain name for api
Resources:
openapi: "3.0.1"
info:
title: "Demo HTTP API"
paths:
/{source}/{detailType}:
post:
responses:
default:
description: "Default response for POST /{source}/{detailType}"
x-amazon-apigateway-integration:
@dobeerman
dobeerman / rotate_my_creds.sh
Last active February 3, 2021 18:46 — forked from keymon/rotate_my_creds.sh
Script to rotate AWS access keys
#!/bin/bash
#
# Will rotate the credentials for the user and account that you have
# currently configured. It will export a new creds to the AWS_ACCESS_KEY_ID
# and AWS_SECRET_ACCESS_KEY environment variables respectively
#
# If you team uses STS with MFA to access the API, you must use those
# STS credentials.
#
@dobeerman
dobeerman / README.md
Created July 18, 2020 09:22
Upload remote file to Amazon S3 bucket

Features:

No external python modules, using AWS Lambda Python 3.6 builtin boto3 and urllib3 Has chunked reading built in, good for downloading large file Efficient connection and memory usage through urllib3 pool management Using configurable upload_fileobj builtin multipart and threaded upload

Original: https://stackoverflow.com/a/47736376/641184

@dobeerman
dobeerman / handler.js
Created November 8, 2019 12:25
Logging decorator for AWS Lambda (Node.js)
const winston = require('winston')
const loggingDecorator = require('./lambda_logger')
async function hello(event, context, callback) {
const logger = winston.loggers.get(this.loggerName)
logger.info({ loggerName: this.loggerName })
const fail = testF() // Should raise an error in logger