Skip to content

Instantly share code, notes, and snippets.

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

Alfonso alfonsodev

🏠
Working from home
View GitHub Profile
@alfonsodev
alfonsodev / how-to-copy-aws-rds-to-local.md
Created May 7, 2019 03:43 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
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
alfonsodev / multiple_ssh_setting.md
Created February 6, 2018 21:26 — forked from jexchan/multiple_ssh_setting.md
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 "your_email@youremail.com"
// 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);
}
@alfonsodev
alfonsodev / action-creator-vs-reducer.md
Created October 22, 2017 11:13 — forked from kof/action-creator-vs-reducer.md
Action creator vs. reducer

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

Reducer

  • should not have any side effects
@alfonsodev
alfonsodev / install-ffmpeg-amazon-linux.sh
Last active November 14, 2017 08:00 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on gist.github.com/gboudreau/install-ffmpeg-amazon-linux.sh
# and https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@alfonsodev
alfonsodev / google-img-resize.mdown
Created February 25, 2016 11:42
Google’s authentication-less on-the-fly image resizing service

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
alfonsodev / gist:24fd06c598f97cd2bbde
Created February 18, 2016 14:53 — forked from billhathaway/gist:e32060b96802d74ca586
Getting IronMQ on-premise running in Vagrant
# more detailed instructions are at http://dev.iron.io/mq-onpremise/getting_started
# Get a coreos VM up
git clone https://github.com/coreos/coreos-vagrant.git
cd coreos-vagrant/
vagrant up
# get into the coreos box
vagrant ssh

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
alfonsodev / main.go
Created September 22, 2015 14:14 — forked from shirou/main.go
ansible module written in go-lang. This is almost same as http://ansible.cc/docs/moduledev.html#reading-input
package main
import (
"fmt"
"os"
"io/ioutil"
"strings"
"time"
"encoding/json"
)
@alfonsodev
alfonsodev / install-comodo-ssl-cert-for-nginx.rst
Last active September 17, 2015 09:00 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com 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