Skip to content

Instantly share code, notes, and snippets.

View dgoguerra's full-sized avatar

Diego Guerra dgoguerra

View GitHub Profile
@dgoguerra
dgoguerra / encrypt.txt
Created May 17, 2023 18:02 — forked from phrfpeixoto/encrypt.txt
Using SSH public key to encrypt a file or string
# Recently I had to send a password to someone over Skype. Since that's obviously not a good idea, I asked for
# the person's public SSH RSA key, and used it to encrypt the password itself.
# Convert the public key into PEM format
ssh-keygen -f path/to/id_rsa.pub -e -m pem > ~/id_rsa.pub.pem
# Using the public pem file to encrypt a string
echo "sometext" | openssl rsautl -encrypt -pubin -inkey ~/id_rsa.pub.pem > ~/encrypted.txt
@dgoguerra
dgoguerra / Dockerfile
Created February 16, 2022 16:36
Install amazonlinux NodeJS
FROM amazonlinux:2
# Install NodeJS v12
RUN set -eux \
&& curl -sL -o nodesource.rpm https://rpm.nodesource.com/pub_12.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm \
&& rpm -i --nosignature --force nodesource.rpm \
&& rm -f nodesource.rpm \
&& yum install -y nodejs
ENTRYPOINT ["node"]
@dgoguerra
dgoguerra / keybase.md
Created August 28, 2019 19:21
Keybase proof

Keybase proof

I hereby claim:

  • I am dgoguerra on github.
  • I am dgoguerra (https://keybase.io/dgoguerra) on keybase.
  • I have a public key ASCsYWW7qgQFJRPGlbFpV_-WXA_jShwnI1sQ283-_b-yKgo

To claim this, I am signing this object:

@dgoguerra
dgoguerra / ngrok-rewrite-host-header.md
Created May 30, 2019 21:55
Ngrok rewrite host header
ngrok http -host-header=rewrite site.dev:80
@dgoguerra
dgoguerra / RestartDatabase.php
Last active May 17, 2019 12:43
Restart and migrate database once before all phpunit tests. Optionally, use a tratit to restart between each test.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class RestartDatabase extends Command
{
/**
@dgoguerra
dgoguerra / libsodium.md
Last active November 10, 2021 02:10
Install libsodium in PHP 7
@dgoguerra
dgoguerra / instance-metadata.md
Created November 26, 2018 13:18
Instance metadata of an EC2 instance (AWS acount ID, region, etc)
curl http://169.254.169.254/latest/dynamic/instance-identity/document
@dgoguerra
dgoguerra / mysql-query-log.md
Last active November 22, 2018 08:44
MySQL general query log

When you have SUPER privileges

# enable query log
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';

# disable query log
SET GLOBAL general_log = 'OFF';
@dgoguerra
dgoguerra / mysql-query-log.md
Created November 22, 2018 08:43
MySQL general query log

## When you have SUPER privileges

# enable query log
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';

# disable query log
SET GLOBAL general_log = 'OFF';
@dgoguerra
dgoguerra / Mac OSX Setup - Brew
Created November 5, 2018 19:01 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install