Skip to content

Instantly share code, notes, and snippets.

View rameerez's full-sized avatar
creating

rameerez rameerez

creating
View GitHub Profile
@rameerez
rameerez / telegram-mtproxy.md
Last active April 25, 2024 18:13
Telegram Proxy How-To: complete and up-to-date MTProxy tutorial

How to set up a Telegram Proxy (MTProxy)

This tutorial will teach you how to set up a Telegram MTProxy on an Ubuntu 22.04 sever using AWS Lightsail, although you can use any other Linux distribution and cloud provider.

Using a Telegram proxy is a safe, easy and effective way of overcoming Telegram bans. It's useful, for example, to keep using Telegram under tyrannical regimes, or to circumvent judges' decisions to block Telegram.

Telegram proxies are a built-in feature in all Telegram apps (both mobile and desktop). It allows Telegram users to connect to a proxy in just one or two clicks / taps.

Telegram proxies are safe: Telegram sends messages using their own MTProto secure protocol, and the proxy can only see encrypted traffic – there's no way for a proxy to decrypt the traffic and read the messages. The proxy does not even know which Telegram users are using the proxy, all the proxy sees is just a list of IPs.

@rameerez
rameerez / mail.example.com.conf
Last active March 29, 2024 04:12
Nginx configuration for Listmonk running on Docker port 9000 using SSL certificates provided by Bitnami on AWS Lightsail
# This file goes in /opt/bitnami/nginx/conf/server_blocks as mail.example.com.conf (make sure to replace the filename with your actual subdomain)
# This Nginx config file assumes we're runing a Bitnami image (thus the non-standard /opt/bitnami paths)
# FULL TUTORIAL to set up Listmonk on AWS Lightsail here: https://rameerez.com/free-mailchimp-alternative-email-marketing-service#listmonk-tutorial
server {
listen 443 ssl;
server_name mail.example.com;
server_tokens off;
ssl_certificate /opt/bitnami/letsencrypt/certificates/mail.example.com.crt;
@rameerez
rameerez / download_controlnet.py
Created February 15, 2024 02:39
Download all CrontrolNet models to Automatic1111
# Meant to be ran inside a `download.ipynb` notebook inside
# the `/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models/` folder
# of an Automatic1111 installation
# !pip install requests
import requests
import os
# List of file names to download
@rameerez
rameerez / aws-ubuntu-server-ec2-instance-setup-for-rails-docker-kamal-deployment.sh
Last active January 16, 2024 02:18
Configure an AWS EC2 instance running Ubuntu Server to deploy Rails apps using Kamal (Docker)
#!/bin/bash
/usr/bin/env curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker ${USER}
mkdir -p /letsencrypt &&
touch /letsencrypt/acme.json &&
chmod 600 /letsencrypt/acme.json
@rameerez
rameerez / aws-amazon-linux-al2023-ec2-instance-setup-for-rails-docker-kamal-deployment.sh
Last active January 14, 2024 20:27
Configure an AWS EC2 instance running Amazon Linux 2023 to deploy Rails apps using Kamal (Docker)
#!/bin/bash
# This scrips takes a clean AWS Amazon Linux 2023 AMI and installs and configures
# everything needed to deploy a Rails app to it using Kamal.
# The resulting state is a clean instance ready to accept Kamal (Dockerized) apps.
# --- AESTHETICS ---
# Define the color code for green for echo messages
@rameerez
rameerez / webmaster_handbook.md
Last active January 14, 2024 00:24
Rails Webmaster's Handbook: useful snippets for a Rails + PostgreSQL server admin

Rails Webmaster's Handbook

Snippets and commands I need to use constantly but that I forget every single time when doing server admin work.

This is an opinionated handbook for Ubuntu Server only

Linux

Change machine name

Goal: make the prompt say ubuntu@easily-identifiable-machine-name instead of the deafult EC2 names like ubuntu@ip-172-168-1-41

@rameerez
rameerez / aws-ubuntu-server-22-04-ec2-instance-setup-for-rails-7-capistrano.sh
Last active January 12, 2024 01:56
Configure an AWS EC2 instance running Ubuntu Server 22.04 LTS to run a Rails 7 app using Capistrano for deployment
#!/bin/bash
# This scrips takes a clean Ubuntu Server 20.04 LTS AMI and installs and configures
# everything needed to deploy a Rails app to it. The resulting state is a clean
# instance that can be used to build a base AMI in AWS.
# --- AESTHETICS ---
# Define the color code for green for echo messages
@rameerez
rameerez / remove-site.sh
Last active December 26, 2023 03:40
Remove site from Apache conf
#!/bin/bash
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo -e "${RED}ERROR: This script must be run as root.${NC}"
exit 1
fi
# Define aesthetics
RED='\033[0;31m'
@rameerez
rameerez / set-up-new-site.sh
Last active December 26, 2023 03:31
Bash script to set up a new site on a LAMP-based Ubuntu server (Wordpress, PHP, etc.)
#!/bin/bash
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo -e "\e[31mERROR: This script must be run as root.\e[0m"
exit 1
fi
# Define aesthetics
GREEN='\033[0;32m'
@rameerez
rameerez / setup_lamp.sh
Last active December 26, 2023 03:23
Script to set up a new LAMP instance from a base Ubuntu 22.04 LTS EC2 instance on AWS
#!/bin/bash
# Ensure the script is run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Define aesthetics
GREEN='\033[0;32m'