Skip to content

Instantly share code, notes, and snippets.

View sonufrienko's full-sized avatar
✌️

Sergii Onufriienko sonufrienko

✌️
View GitHub Profile

Buld Docker image on ARM (Apple M1/M2)

docker buildx build --platform=linux/amd64 -t demo .
@sonufrienko
sonufrienko / 1-setup.md
Created February 8, 2023 09:49 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

I dont know exactly what I did, but I resolved my problem.

  1. I updated MacOS and Xcode
  2. I uninstalled cocoapods from gem gem uninstall cocoapods
  3. I had some error while I was running bundle exec pod install. So I used sudo xcode-select --switch /Applications/Xcode.app link
  4. Then sudo xcodebuild -license accept
  5. Then I ran installer npx react-native init template --template react-native-template-typescript and everything was good!

Also I can recommend you to use these commands to know where is your error

@sonufrienko
sonufrienko / graphql-load-testing.md
Last active July 19, 2022 04:52
Graphql API Load Testing

Basic use

wrk -c <user-count> -t <cpu-core-count> -d 10 --latency https://your-server/endpoint

GraphQL API

wrk -s script.lua https://your-server/api/graphql
@sonufrienko
sonufrienko / aws-cli.sh
Last active July 12, 2022 03:45
Useful AWS CLI commands
export AWS_COGNITO_REGION=
export AWS_COGNITO_USERPOOL_ID=
export AWS_COGNITO_CLIENT_ID=
export AWS_COGNITO_USERNAME=
export AWS_COGNITO_PASSWORD="
# Cognito change password
aws cognito-idp respond-to-auth-challenge \
--region $AWS_COGNITO_REGION \
--client-id $AWS_COGNITO_CLIENT_ID \
@sonufrienko
sonufrienko / aws-client-vpn.md
Last active April 14, 2022 09:48
AWS Client VPN

Create Certificates

git clone https://github.com/OpenVPN/easy-rsa
cd easy-rsa/easyrsa3
./easyrsa init-pki
./easyrsa build-ca nopass
./easyrsa build-server-full server nopass
./easyrsa build-client-full client1.domain.tld nopass
@sonufrienko
sonufrienko / node-on-ec2-port-80.md
Last active May 2, 2020 14:24 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

One possibly-right way:

Add a port forwarding rule via iptables.

First, I listed the rules currently running on the NAT (Network Address Translation) table:

@sonufrienko
sonufrienko / aws-alb-modify-rule.sh
Created March 25, 2019 09:06
Blue/Green Deployments. Switch ECS target group on ALB.
# Get all Rules from Listener
aws elbv2 describe-rules \
--listener-arn {alb-listener-arn}
# Get Rule
aws elbv2 describe-rules \
--rule-arn {alb-rule-arn}
# Modify Rule
aws elbv2 modify-rule \
# Generate private and public keys
# RSA 2048
# Quiet mode
# Without a passphrase
ssh-keygen -t rsa -b 2048 -q -N '' -m PEM -f private.key \
&& rm private.key.pub \
&& openssl rsa -in private.key -pubout -outform PEM -out public.key
@sonufrienko
sonufrienko / kafka-cheat-sheet.md
Created February 24, 2019 09:58 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...