Skip to content

Instantly share code, notes, and snippets.

View felipekm's full-sized avatar
🦈

Felipe Kautzmann felipekm

🦈
View GitHub Profile
@felipekm
felipekm / certbot.md
Last active May 3, 2024 14:57
Ubuntu - Setup free SSL HTTPS for your domain

It installs Let’s Encrypt client certbot, download SSL and certificates for your domain, configures Nginx to use these certificates, and set up automatic certificate renewal

Step 1 — Installing Certbot

sudo snap install core; sudo snap refresh core sudo apt remove certbot sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot

Step 2 — Confirming Nginx’s Configuration

scp -i "{KEY_PAGE}" FILES ec2-user@ec2-{IPNUMBER}.sa-east-1.compute.amazonaws.com:~/{FOLDER_NAME}
@felipekm
felipekm / check-git.sh
Created April 27, 2020 13:17
Shell - Check if the folder is a git repo
#!/bin/sh
if git rev-parse --git-dir > /dev/null 2>� then
# git repo!
else
# NOT a git repo!
fi
@felipekm
felipekm / server.js
Created April 23, 2020 00:05
asset prefix next server
const express = require('express');
const proxy = require('http-proxy-middleware');
const next = require('next');
const assetPrefix = process.env.ASSET_PREFIX || "";
const proxyPort = parseInt(process.env.PROXY_PORT, 10) || 9000;
const nextPort = parseInt(process.env.NEXT_PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
@felipekm
felipekm / fix_sharp.sh
Created March 20, 2020 03:02
nodejs sharp issue problem
sudo npm i --unsafe-perm=true --allow-root
sudo chmod -R 777 node_modules/
npm rebuild sharp --allow-root
@felipekm
felipekm / grep_multi.sh
Created March 19, 2020 18:47
grep with multi line
# List 5 lines below the scripts grep
cat package.json | grep -b 5 scripts
# List 5 lines above the scripts grep
cat package.json | grep -a 5 scripts
@felipekm
felipekm / chmod_exec.sh
Last active March 20, 2020 20:47
Linux gives permission to a folder recursive
sudo chmod -R a+rwx /path/to/file
@felipekm
felipekm / install_gcc.sh
Created March 19, 2020 03:41
Install GCC 4.9.3 linux
#!/bin/bash
# this script installs GCC 4.9.3
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.3.sh
# download and install gcc 4.9.3
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
tar xzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
@felipekm
felipekm / find-acm-by-domain-name.sh
Created February 19, 2020 13:22
Find ARN for ACM certificate for a given domain name
#!/bin/bash
aws acm list-certificates --query CertificateSummaryList[].[CertificateArn,DomainName] | grep -B 1 domainname.com | cut -f1
@felipekm
felipekm / .bashrc
Created February 3, 2020 14:53
Linux find large files quickly with bash alias
## shell alias ##
alias ducks='du -cks * | sort -rn | head'
### run it ###
ducks