Skip to content

Instantly share code, notes, and snippets.

View alfmatos's full-sized avatar

Alfredo Matos alfmatos

View GitHub Profile
@alfmatos
alfmatos / wp-aws-lightsail-cheatsheet.md
Last active December 10, 2020 10:16
Wordpress on Lightsail Cheat Sheet

Wordpress on Lighsail 2018.14

Setup new instance

Create and setup and instance on AWS Lightsail with a public ip address, an ssh user and an access key. Place the access key on the the local .ssh, and create the proper Host entry on .ssh/config.

Don't forget to update the dns entry to the public lightsail address.

Update the system

@alfmatos
alfmatos / rails_aes_crypto.rb
Created July 4, 2019 10:21
Encrypt and decrypt dada using AES in rails
def aes_encrypt(key, data)
aes = OpenSSL::Cipher.new('AES-256-CBC')
aes.encrypt
aes.key = Digest::SHA256.digest(key)
aes.update(data) + aes.final
end
def aes_decrypt(key, encrypted_data)
aes = OpenSSL::Cipher.new('AES-256-CBC')
aes.decrypt
@alfmatos
alfmatos / settings.json
Last active February 11, 2019 00:27
Visual Studio Code Config for Rails development
{
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
"workbench.statusBar.feedback.visible": false,
"workbench.activityBar.visible": true,
"workbench.colorTheme": "Material Theme High Contrast",
"materialTheme.accent": "Acid Lime",
"workbench.iconTheme": "eq-material-theme-icons",
"workbench.colorCustomizations": {
"activityBarBadge.background": "#C6FF00",
@alfmatos
alfmatos / nodejs-yarn-install.sh
Last active June 6, 2019 17:58
Docker nodejs and yarn install (for bitbucket pipelines)
#!/bin/bash
# Script to install node.js 10.x and yarn repo onto a Debian or Ubuntu system (docker)
#
# Run as root or insert `sudo -E` before `bash`:
#
# Example: curl -sL https://gist.githubusercontent.com/alfmatos/f0a5218c80e4866da1beb90cffb008f9/raw/ | bash -
# Install nodejs 10.x
curl -sL https://deb.nodesource.com/setup_10.x | bash -
@alfmatos
alfmatos / certbot-renew-cron.sh
Last active October 19, 2017 13:58
Certbot renew for ngnix
#!/usr/bin/env sh
# certbot for letsencrypt to renew certificates
# this can be used in a crontab entry
# 0 4 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start" --dry-run
certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
[alias]
ls = log --pretty=format:'%C(yellow)%h%Creset %s %Cgreen(%cr)%Creset %Cred%d%Creset' --abbrev-commit --date=relative