Skip to content

Instantly share code, notes, and snippets.

@irokhes
irokhes / transfer_ssm_file.sh
Created September 13, 2024 07:02 — forked from lukeplausin/transfer_ssm_file.sh
Transfer a file to EC2 SSM instance without using S3 (SSM only)
# This script will explain how to transfer a file to EC2 using SSM ONLY!
# You will need to have permission to run SSM commands on the target machine and have sudo access as well
# Infos
INSTANCE_ID=i-1234567890
FILE_NAME=the_file.tar.gz
# Step 1: Run command on machine to install netcat and dump from port to filename
# < Start session
@irokhes
irokhes / get_telegram_channel_id
Created September 26, 2021 18:50
How to obtain the chat_id of a private Telegram channel
You should convert it to public with some @channelName
Send message to this channel through Bot API
https://api.telegram.org/bot111:222/sendMessage?chat_id=@channelName&text=123
bot+[yoour bot id]
As response you will get info with chat_id of your channel.
@irokhes
irokhes / Connecting_postgress_RDS_from_local_via_bastion.md
Created February 9, 2021 09:29 — forked from kshailen/Connecting_postgress_RDS_from_local_via_bastion.md
Ways to connect to postgress RDS instance from bastion host and from local host

When it comes to databases and AWS VPC, best practice is to place your database in private subnet. By definition, private subnet in AWS is not reachable from the Internet because no Internet gateway is attached to private subnet. This is the way you protect your data. This kind of configuration is good for security but bad for data management.

How can you easily access and manage your secured data?

basic_RDS_bastion_architecture

There are two basic ways to acees it.

  1. Access postgres RDS from bastion host. There are following requirements for this.
@irokhes
irokhes / docker-cheatsheet
Last active June 14, 2020 10:51
List of Docker commands
# Get a local Shell of container
docker run -i -t --entrypoint /bin/bash imageID
# Create image using this directory's Dockerfile
docker build -t friendlyname .
# Run "friendlyname" mapping port 4000 to 80
docker run -p 4000:80 friendlyname
# Same thing, but in detached mode
docker run -d -p 4000:80 friendlyname
# See a list of all running containers
docker ps

Keybase proof

I hereby claim:

  • I am irokhes on github.
  • I am irokhes (https://keybase.io/irokhes) on keybase.
  • I have a public key ASBHaDy-KwFQKwCflwjjTGtWc3UILOA1tYle6ceySK755Qo

To claim this, I am signing this object:

@irokhes
irokhes / restart_mac_audio_driver_command
Created March 10, 2020 11:44
Restart Mac audio driver
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' | awk '{print $1}'`

Restart deployment

kubectl rollout restart deploy/admission-control

Instalación

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version
@irokhes
irokhes / Readme.md
Last active October 5, 2022 11:47 — forked from cunneen/Readme.md
Install Open GApps In Android Emulator

Introduction

This works to install Open GApps into the Android Emulator, working around the issue where the system partition is too small.

With it, I can get Google Play installing into the emulator. Tested on KitKat (API 19), Lollipop (API 21) and Oreo (API 27).

It's tested on MacOS.

Instructions

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@irokhes
irokhes / assert-rejection
Created November 28, 2018 14:51
Function to assert against promise rejection
//Credit to:
//https://www.nearform.com/blog/avoiding-common-hurdles-in-unit-testing/
const expectRejection = async (p, message) => {
try {
await p
} catch (error) {
if (error.message === message) return
throw new Error('Expected error "${message}" but found "${error.message}"')
}