Skip to content

Instantly share code, notes, and snippets.

View bugb's full-sized avatar
🎯
Do it small and do it well!

Chau Giang bugb

🎯
Do it small and do it well!
View GitHub Profile
@bugb
bugb / get.md
Created December 27, 2023 09:59
Get current P2P trading ads
import requests


headers = {
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
    "Cache-Control": "no-cache",
 "Connection": "keep-alive",
@bugb
bugb / List-all-slacks-public-channels.md
Last active December 27, 2023 10:06
How to list all public channels in a Slack workspace using API?

1. Set up a Slack App:

Go to the Slack App Management page. Click on "Create New App" and follow the instructions to set up your app.

2. Install App to Workspace:

After creating the app, install it to your workspace. Get OAuth Access Token: Once installed, you'll receive an OAuth access token. This token will be used to authenticate your requests.

3. Run the Python scripts:

@bugb
bugb / gist:91e811a783190d88f183c61cc8ad9ff3
Last active November 25, 2022 06:39
Allocate ECS agent to another ECS cluster
sudo -s
service ecs stop
docker stop ecs-agent
docker rm ecs-agent
mv /var/lib/ecs/data/agent.db{,.bak}
sed -i 's/Prod-BC-ECS-ElasticSearch-Standard-C1/Prod-BC-ECS-ElasticSearch-Premium-C1/g' /etc/ecs/ecs.config
echo -e 'ECS_DATADIR=/data\nECS_ENABLE_TASK_IAM_ROLE=true\nECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST=true\nECS_LOGFILE=/log/ecs-agent.log\nECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs"]\nECS_LOGLEVEL=info' >> /etc/ecs/ecs.config
echo "ecs config is: "
cat /etc/ecs/ecs.config
@bugb
bugb / arch_installation.md
Created October 27, 2022 18:10 — forked from eltonvs/arch_installation.md
Arch Linux step to step installation guide

Arch Linux Installation Guide

This guide will show step-by-step how to Install Arch Linux on UEFI mode.

Table of Contents

  • Bootable Flash Drive
  • BIOS
  • Pre installation
    • Set Keyboard Layout
    • Check boot mode
  • Update System Clock
@bugb
bugb / arch-i3gaps-install.md
Created October 11, 2022 02:50 — forked from fjpalacios/arch-i3gaps-install.md
Arch + i3-gaps Install Guide

Arch + i3-gaps Install Guide

First set up your keyboard layout. For example, in Spanish:

   # loadkeys es

For a list of all acceptable keymaps:

   # localectl list-keymaps
@bugb
bugb / setup.sh
Created July 16, 2022 04:28 — forked from felipecsl/setup.sh
Base EC2 instance setup for Amazon Linux box
# Install all the packages
sudo yum install -y \
curl gpg gcc gcc-c++ make git \
openssl-devel readline-devel libcurl-devel \
zlib-devel postgresql-server.x86_64 ruby-devel \
sqlite sqlite-devel ruby-rdoc python-devel \
cairo-devel libffi-devel python-pip nc docker \
tmux htop postgresql-libs postgresql-devel \
amazon-cloudwatch-agent
@bugb
bugb / tweepy.md
Created December 26, 2021 19:57
How to get latest tweet for a user with python and tweepy.

Set tweepy

To install tweepy do:

pip install tweepy

More information at http://tweepy.org.

Get keys and tokens from Twitter

@bugb
bugb / S3-Static-Sites.md
Created August 13, 2021 17:02 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@bugb
bugb / awc-ecs-access-to-aws-efs.md
Created August 9, 2021 14:50 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide: