Skip to content

Instantly share code, notes, and snippets.

@juandm
juandm / README-Template.md
Created September 20, 2017 20:05 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

ODE Server running troubleshooting

- Installing the tools

After download Tomcat server and ODE deployable distribution (war).

  1. Download an Apache Tomcat Server at http://tomcat.apache.org/.

  2. Install Tomcat to a directory of your choice. For example "C:\tomcat-5.5.26." This directory will be referred to as TOMCAT_INSTALL_DIR.

@juandm
juandm / vagrant_Changing_API_URL.md
Last active April 2, 2018 20:25
Workarround for Google chrome update v63 that breaks .dev domains in laravel Homestead

Workarround!

We should change de app domain:

  1. go to etc/ folder in your host machine
  2. Edit the hosts file and change the old URL to end with .test (Exp: http://myappdevdomain.test)
  3. Go to Homestead folder and edit the homestead.yaml file
    sites:
    - map: http://myappdevdomain.test

to: /home/vagrant/Code/rise-api/public

@juandm
juandm / onlyNumberCrossReferenceWord.md
Created April 11, 2018 16:59
Creating a corss reference with only the number in WORD 2016

Changing WORD cross reference to show only numbers

  1. Insert the cross reference normally.
  2. Rigth Click in the created reference and select Edit Field.
  3. In the opened window click in Field Codes button: You should see something like that: REF _Ref511217882 \h
  4. Change the text adding the \# 0 as showed below:
@juandm
juandm / See_JAR_Content_In_Firefox.md
Created July 17, 2018 14:22
A way to see jar content without unzip it, using Firefox browser

See content of JAR file in Firefox web Browser

Open firefox and put in the address bar the following comand:

NOTE the " !/ " at the end

jar:file://path-to-the-jar-file!/

Example

jar:file:///C:/apache-tomcat-9.0/jarfiles/code-SNAPSHOT.jar!/

@juandm
juandm / AsyncFor_NodeJS.md
Last active October 23, 2018 18:38
Example of multiple async works inside a loop in NodeJS

Node JS - Async for loop

The following code simulates multiple async HTTP requests using a for loop in node.

// Simulation of HTTP call that returns a promise after ms milliseconds
const waitFor = (ms) => new Promise(r => setTimeout(r, ms));

// Http requests array
const httpRequests = [
@juandm
juandm / MultipleSSHGitAccounts.md
Last active February 22, 2024 02:50
Set up multiple git accounts (Gitlab, Github, Bitbucket) with SSH in the same machine

Multiple GIT accounts setup

This short tutorial shows how to set up multiple different accounts of many git repository sites using SSH, all this tutorial and its commands were aplied in Ubuntu.

Generate SSH keys

Generate SSH keys for each one of the sites you wanna connect:

  1. Open your terminal and type the following command to generate a RSA key:

ssh-keygen -o -t rsa -b 4096 -C "[email protected]"

@juandm
juandm / Dump&RestoreDB.md
Created July 26, 2019 22:03
Some usefull commands to restore in development environment a production database

Dump and Restore DB in Postgres Ubuntu (this is a draft, hope will be better explained)

  1. Open terminal and execute to use postgres user sudo -i -u postgres Note that the terminal now is -> postgres@user:~$

  2. Create a database executing the command createdb mydatabasename

  3. Create an user executing the command createuser user -P this is going to ask a password

  4. Assign postgres role to the local db user executing the following command in psql console:

  1. Delete all local branchs except master and develop
git branch | grep -v "master\|develop" | xargs git branch -D
  1. Delete local refs to deleted remote branchs.

    • Verify branchs

Dump and Restore postgres Database

1. Dump

In this gist we are going to use the pg_dump tool to back up a remote postgres database and pg_restore to restore the dump in a local database.

  1. If postgres is not installed directly in your machine because you are usign it via docker containers, first you should install the postgresql client utility in your host machine, this client includes psql and pg_dump tools.