Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View azakordonets's full-sized avatar

Andrew Zakordonets azakordonets

View GitHub Profile
{
"values": [
{
"country": "Albania",
"length": "28",
"code": "AL",
"format": "AL2!n8!n16!c"
},
{
"country": "Andorra",
@azakordonets
azakordonets / catalog-info.yaml
Created February 24, 2023 12:39
ChatGPT3 generated catalog-info.yaml example for Backstage.io
# Example entities.yaml file for Backstage.io
# Systems
- kind: System
metadata:
name: Trello
description: Web-based project management tool
namespace: my-namespace
spec:
owner: myteam
@azakordonets
azakordonets / .gitlab-ci.yml
Created November 10, 2022 19:24
This setup helps to run Jest tests on Gitlab in parallel
stages:
- prepare
- build
- test
- post_test
unit tests:
timeout: 20 minutes
stage: test
variables:
import boto3
import json
# Create CloudWatchLogs client
cloudwatch_logs = boto3.client('logs')
paginator = cloudwatch_logs.get_paginator('describe_log_groups')
subscription_details = {}
for response in paginator.paginate():
for logGroup in response['logGroups']:
log_group_name = logGroup['logGroupName']
subscription_filters = cloudwatch_logs.describe_subscription_filters(logGroupName = log_group_name)
@azakordonets
azakordonets / encryptPassWordWithCryptoJs.js
Last active July 25, 2022 10:21
This gist describes how to encode password with salt using SHA256 algorithm. It shows how to do it with google crypto-js library and Node.js module crypto
var CryptoJS = require('crypto-js');
var algo = CryptoJS.algo.SHA256.create();
algo.update(password, 'utf-8');
algo.update(CryptoJS.SHA256(salt), 'utf-8');
var hash = algo.finalize().toString(CryptoJS.enc.Base64);
console.log(hash);
def convertFromSnakeToCamel(string):
return string[0].lower() + ''.join(x.capitalize() or '_' for x in string.split('_'))[1:]
@azakordonets
azakordonets / cloudwatch_client_mock.go
Last active August 26, 2020 21:08
Testing part of cloudwatch client for blog post
package aws
import (
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/cloudwatchlogsiface"
)
// CloudWatchLogsClientMock is a mock for cloudwatch logs client
type CloudWatchLogsClientMock struct {
cloudwatchlogsiface.CloudWatchLogsAPI
Psfr func(input *cloudwatchlogs.PutSubscriptionFilterInput) cloudwatchlogs.PutSubscriptionFilterRequest
@azakordonets
azakordonets / aws_error.go
Created August 26, 2020 21:04
Cloudwatch client with retry for a blog post
package aws
// Error implements AWS Error interface
type Error struct {
error
ErrorCode string
ErrorMessage string
OriginalError error
}
@azakordonets
azakordonets / aws_error.go
Created August 26, 2020 20:55
This is how you can work with cloudwatch sdk and handle ThrottlingException
package aws
// Error implements AWS Error interface
type Error struct {
error
ErrorCode string
ErrorMessage string
OriginalError error
}
@azakordonets
azakordonets / generate_rsa_ssh_keys.go
Last active August 17, 2020 23:46 — forked from devinodaniel/gist:8f9b8a4f31573f428f29ec0e884e6673
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"