Skip to content

Instantly share code, notes, and snippets.

View CarlosLugones's full-sized avatar
Building great stuff

Carlos Lugones CarlosLugones

Building great stuff
View GitHub Profile
@CarlosLugones
CarlosLugones / recover-deleted-branch.sh
Created June 1, 2022 15:23 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
git pull origin live
docker-compose build
docker-compose up -d
@CarlosLugones
CarlosLugones / api.py
Created October 20, 2021 20:55
Wireguard API
import os
import subprocess
from fastapi import FastAPI
from pydantic import BaseModel
from dotenv import load_dotenv
# We load the env vars from a .env file
load_dotenv()
# Token uses by master to send commands to this node
@CarlosLugones
CarlosLugones / Dockerfile
Created October 20, 2021 20:53
Wireguard node with API exposed
FROM linuxserver/wireguard as lugodev_vpn_node
RUN apt-get -y update
RUN apt-get install -y python3.6 python3-pip python-dev build-essential python3-venv
RUN mkdir -p /codebase
ADD . /codebase
WORKDIR /codebase
RUN pip3 install -r requirements.txt
@CarlosLugones
CarlosLugones / vpn-node.yml
Last active October 20, 2021 20:50
vpn-node.yml
version: "3"
services:
# https://hub.docker.com/r/linuxserver/wireguard
# A VPN node with Wireguard service and an API exposed over 8008 port, based in FastAPI
lugodev_vpn_node:
build:
context: "."
dockerfile: Dockerfile
@CarlosLugones
CarlosLugones / bot.py
Created July 24, 2021 18:30
Telegram bot menus
# This is a way (not optimized) to handle menus on your Telegram bot.
# I haven't tested this code, but it should work.
# Join the community: https://t.me/LugodevChat
import telegram
from telegram import InlineKeyboardMarkup, InlineKeyboardButton, ParseMode, ChatAction
def start(update, context):
update.message.reply_text(
text='Hola, selecciona una opción',
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx
@CarlosLugones
CarlosLugones / install-portainer.sh
Created July 25, 2020 00:28
Install and run Portainer.io
echo 'Port to expose Portainer (9000 is suggested):'
read port
echo Creating Portainer volume...
docker volume create portainer_data
echo Installing and starting up Portainer...
docker run -d -p $port:$port --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \