Skip to content

Instantly share code, notes, and snippets.

Working from home

Alfonso alfonsodev

Working from home
View GitHub Profile
alfonsodev /
Created May 7, 2019 — forked from syafiqfaiz/
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
alfonsodev /
Created Feb 6, 2018 — forked from jexchan/
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""
View redux-saga-retry.js
// Retry 5 times with waiting for 2 seconds
function* updateApi(data) {
for(let i = 0; i < 5; i++) {
try {
const apiResponse = yield call(apiRequest, { data });
return apiResponse;
} catch(err) {
if(i < 4) {
yield call(delay, 2000);

When should you use action creator and when reducer?

Action creator

  • you need to have side effects
  • you need to read from store to decide what to do
  • you need to dispatch more than one action
  • action produced by action creator needs to contain all the data reducer can need to shape the components state


  • should not have any side effects
alfonsodev /
Last active Nov 14, 2017 — forked from gboudreau/
How to compile ffmpeg on Amazon Linux (EC2)
# Based on
# and
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
cat > /etc/yum.repos.d/centos.repo<<EOF
alfonsodev / google-img-resize.mdown
Created Feb 25, 2016 — forked from czottmann/google-img-resize.mdown
Google’s authentication-less on-the-fly image resizing service
View google-img-resize.mdown

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

alfonsodev / gist:24fd06c598f97cd2bbde
Created Feb 18, 2016 — forked from billhathaway/gist:e32060b96802d74ca586
Getting IronMQ on-premise running in Vagrant
View gist:24fd06c598f97cd2bbde
# more detailed instructions are at
# Get a coreos VM up
git clone
cd coreos-vagrant/
vagrant up
# get into the coreos box
vagrant ssh
View ddd-in-golang.markdown

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story

alfonsodev / main.go
Created Sep 22, 2015 — forked from shirou/main.go
ansible module written in go-lang. This is almost same as
View main.go
package main
import (
alfonsodev / install-comodo-ssl-cert-for-nginx.rst
Last active Sep 17, 2015 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert