Skip to content

Instantly share code, notes, and snippets.

View martinacostadev's full-sized avatar
👨‍💻

Martín Acosta Dev martinacostadev

👨‍💻
View GitHub Profile
@martinacostadev
martinacostadev / index.js
Last active July 23, 2020 19:56
node express sql server / Connect to SQL Server, run script and show in web with NodeJS
/*
Connect to SQL Server, run script and show in web with NodeJS
Commands:
npm init
npm install
npm install express
npm install mssql
@martinacostadev
martinacostadev / JS-LINQ.js
Created April 14, 2020 17:53 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@martinacostadev
martinacostadev / node_nginx_ssl.md
Created April 6, 2020 12:50 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@martinacostadev
martinacostadev / Deshabilitar Caps Locks Consola Ubuntu 18
Created March 25, 2020 23:28
Deshabilitar Caps Locks Consola Ubuntu 18
Para ver la lista de teclas
setleds
setleds -D -caps
Error: Request failed with status code 404
at createError (/usr/src/app/node_modules/axios/lib/core/createError.js:16:15)
at settle (/usr/src/app/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/usr/src/app/node_modules/axios/lib/adapters/http.js:236:11)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
config: {
url: 'https://martinacosta.com.ar/api/coffees?password=undefined',
method: 'get',
@martinacostadev
martinacostadev / SSL Droplet Ubuntu DigitalOcean
Last active March 24, 2020 16:15
Agregar SSL en Droplet Ubuntu DigitalOcean
https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04
---
Versión anterior de Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04
@martinacostadev
martinacostadev / docker logs to file
Created March 24, 2020 12:59
Guardar docker log en archivo
docker logs nombredocker > docker.log 2>docker.err
Se guarda en la misma carpeta donde se ejecuta el comando. El archivo err contiene los errores que puedan surgir y que en consola con dockers logs no se llegan a leer.
@martinacostadev
martinacostadev / wordpress-change-domain-migration.sql
Created October 2, 2019 13:44 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);