Skip to content

Instantly share code, notes, and snippets.

View cgtarmenta's full-sized avatar
🏠
Working from home

Carlos G. T. Armenta Andrade cgtarmenta

🏠
Working from home
View GitHub Profile
@cgtarmenta
cgtarmenta / install.sh
Last active October 30, 2023 17:47
Ubuntu 20.04 WP boilerplate
#!/bin/bash
# Usage:
# sudo ./script_name.sh [--domain=example.com] [--db_name=wordpress] [--db_user=wordpressuser] [--db_pass=password] [--ftp_user=ftpuser] [--ftp_pass=generated_password]
# All parameters are optional and will default to the values specified in the script.
# Default values
DOMAIN="example.com"
DB_NAME="wordpress"
DB_USER="wordpressuser"
@cgtarmenta
cgtarmenta / 2019-https-localhost.md
Created July 2, 2023 12:07 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

#!/usr/bin/env bash
# WP-CLI Back up Script to Amazon S3
# Source: https://www.jonathan.vc
# Author: Jonathan Dingman
# Adapted from Mike at WP Bullet
#define local path for backups
BACKUPPATH=/tmp/backups
#path to WordPress installations
@cgtarmenta
cgtarmenta / ecosystem.config.js
Last active May 5, 2023 12:06
NodeJS deployment helpers
// Example of PM2 ecosystem file, working with nvm environment
// on a AWS EC2 instance running ubuntu
const HOST = '';
const REPONAME = '';
module.exports = {
apps: [
{
name : 'DEVICES:API',
script : 'server.js',
@cgtarmenta
cgtarmenta / getwildcardcert.sh
Last active January 21, 2023 11:25
A simple cloudflare-LetsEncrypt auto issue/renew script
#!/bin/bash
# Setting variables to run
DOMAIN="exampledomain.com"
CLOUDFLAREEMAIL="clouflare.account@email.com"
CLOUDFLAREAPIKEY="0192837465918234650192837465"
RANDOMLEVEL4=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
# Verifying script is run as root
@cgtarmenta
cgtarmenta / README-setup-tunnel-as-systemd-service.md
Created November 29, 2019 16:26 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@cgtarmenta
cgtarmenta / nginx-plus-install.sh
Created October 20, 2019 03:33 — forked from rahul286/nginx-plus-install.sh
nginx-plus installation
mkdir /etc/ssl/nginx
wget -P /etc/ssl/nginx/ https://cs.nginx.com/static/files/CA.crt
## move nginx-repo.crt to /etc/ssl/nginx/nginx-repo.crt
## move nginx-repo.key to /etc/ssl/nginx/nginx-repo.key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
apt-get install apt-transport-https libgnutls26 libcurl3-gnutls
printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list
@cgtarmenta
cgtarmenta / proguard-rules.pro
Created February 12, 2018 03:09 — forked from bkhezry/proguard-rules.pro
Proguard rules for popular libraries.
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\bkhezry\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
@cgtarmenta
cgtarmenta / proguard-rules.pro
Created February 12, 2018 03:09 — forked from bkhezry/proguard-rules.pro
Proguard rules for popular libraries.
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\bkhezry\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
@cgtarmenta
cgtarmenta / Documentation.md
Created July 1, 2016 17:02 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs