Skip to content

Instantly share code, notes, and snippets.

View lacoski's full-sized avatar
😀
An Introvert Engineer

Nguyễn Bá Thành lacoski

😀
An Introvert Engineer
View GitHub Profile
@lacoski
lacoski / lambda-aws-ssm-run-command-on-ec2-instance.py
Created July 5, 2022 15:37 — forked from lrakai/lambda-aws-ssm-run-command-on-ec2-instance.py
Run commands on EC2 instances using Lambda and Systems Manager (SendCommand)
import boto3
import botocore
import time
def handler(event=None, context=None):
client = boto3.client('ssm')
instance_id = 'i-07362a00952fca213' # hard-code for example
response = client.send_command(
@lacoski
lacoski / HashiCorp Certified: Terraform Associate 2021
Created July 5, 2022 07:38 — forked from vsathyak/HashiCorp Certified: Terraform Associate 2021
HashiCorp Certified: Terraform Associate 2021 by Zeal
Getting Started & Setting Up Labs : Choosing a right Infrastructure as Code tool
********************************************************************************
- Terraform
- CloudFormation
- Heat
- Ansible
- SaltStack
- Chef, Puppet and Others
@lacoski
lacoski / list_objects_google_storage_boto3.py
Created May 25, 2022 16:59 — forked from gleicon/list_objects_google_storage_boto3.py
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@lacoski
lacoski / list.txt
Created May 6, 2022 03:29 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@lacoski
lacoski / WireGuard_Setup.txt
Created October 10, 2020 09:41 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@lacoski
lacoski / dockergrep.sh
Created September 23, 2020 16:09 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@lacoski
lacoski / dockergrep.sh
Created September 23, 2020 16:09 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@lacoski
lacoski / gist:3e0ee45d4276be9d6dca689366197026
Created August 11, 2020 03:50 — forked from dotcomputercraft/gist:0947eb7ed6b3b5cc14b6
increase max number of ulimit open file and max user processes in Linux.
1- Step : open the sysctl.conf and add this line fs.file-max = 65536
vi /etc/sysctl.conf add end of line
fs.file-max=500000
save and exit.
2. Step : vi /etc/security/limits.conf and add below the mentioned
* soft nproc 500000
@lacoski
lacoski / gist:e6755f6d87161aaf8706fa5c4ebd72ac
Created August 11, 2020 03:50 — forked from dotcomputercraft/gist:0947eb7ed6b3b5cc14b6
increase max number of ulimit open file and max user processes in Linux.
1- Step : open the sysctl.conf and add this line fs.file-max = 65536
vi /etc/sysctl.conf add end of line
fs.file-max=500000
save and exit.
2. Step : vi /etc/security/limits.conf and add below the mentioned
* soft nproc 500000
@lacoski
lacoski / openvpn-telegram.md
Last active June 5, 2020 03:08 — forked from jovimon/openvpn-telegram.md
Telegram notifications for (dis)connections to my pfSense OpenVPN Server

OpenVPN Telegram Notifier

Features

Each time a client (dis)connects to the OpenVPN server of pfSense a new Telegram notification will be sent.

pfSense WebGUI configuration

Under "VPN" > "Servers" > your server > "Advanced Configuration" > "Custom Options" add the following lines.

client-connect    /root/openvpn-telegram.sh
client-disconnect /root/openvpn-telegram.sh