Skip to content

Instantly share code, notes, and snippets.

View gnppro's full-sized avatar
🇲🇽

Gerardo Nava Pereda gnppro

🇲🇽
View GitHub Profile
@gnppro
gnppro / MySQL.md
Last active April 18, 2020 01:37
Cheat Sheet - MySQL | MariaDB -

Install

sudo apt install mariadb-server
sudo apt install mysql-server

Initialize

sudo mysql -u root
sudo mysql -u root -p
@gnppro
gnppro / steps.md
Created April 17, 2020 05:31 — forked from nicobytes/steps.md
Docker Sawrm
  1. Create machines / nodes
dashboard-prod-m1
dashboard-prod-m2
dashboard-prod-m3
  1. Update machine
@gnppro
gnppro / cloudSettings
Last active January 15, 2021 01:00
Config for My VSCode 2020
{"lastUpload":"2020-06-03T22:28:46.871Z","extensionVersion":"v3.4.3"}
@gnppro
gnppro / map-reduce.js
Created March 31, 2020 20:55
Usar peticiones asincronas y map reduce
const axios = require("axios");
const API = "https://jsonplaceholder.typicode.com";
const ids = [1, 2, 3];
const promises = ids.map(id => axios.get(`${API}/todos?userId=${id})`));
// const rta = results
const results = (await Promise.all(promises))
.map(response => response.data)
@gnppro
gnppro / Windows Command Line
Last active August 18, 2020 15:34
Config Terminal
set PATH=%PATH%;"C:\foo\bar"
mongo url --user <user>

show dbs

use my-db-name

db.inventory.insertOne({
  item: "t-shirt",
  qty: 100,
@gnppro
gnppro / svg-to-string.js
Created January 17, 2020 21:07
Get SVG to String
'data:image/svg+xml;utf8,
<svg xmlns="http://www.w3.org/2000/svg" width="94" height="35" viewBox="0 0 94 35">
<g fill="none" fill-rule="evenodd">
<path fill="%23183D7B" d="M42.086 16.762c0-.964.174-1.308-.915-1.882l-.754-.368v-.665h7.512v.665l-.766.299c-1.136.46-1.136.585-1.112 1.951l.011 5.498-.278.264c-1.31.333-4.37 1.159-7.13 1.159-6.328 0-9.446-3.248-9.446-10.272 0-7.553 4.405-10.824 10.189-10.824 1.553 0 4.37 0 6.329 1.642.65.54.707 1.147.707 1.388 0 .46-.093.551-.185.735l-1.403 2.697h-.522c0-1.331-1.564-4.878-5.633-4.878-4.718 0-4.95 3.26-4.95 8.769 0 4.82.51 9.159 6.144 9.159 1.82 0 2.156-.952 2.202-2.02v-3.317M49.806 22.615l1.345-.539c1.101-.425 1.101-1.217 1.101-2.973V6.443c0-.975-.278-1.457-1.043-1.973l-1.229-.815v-.666h5.576l.336.207c.614.815 1.89 3.007 3.605 5.302l5.912 7.966c.244.332.371.482.487.482.243 0 .243-.299.243-.85v-9.63c0-1.388-.023-1.663-1.217-2.145l-1.75-.666v-.666h7.013v.666l-.893.333c-1.31.516-1.564.815-1.564 2.812v11.936c0 1.825.034 3.673.034 4.304l-.208.241h-1.716l-.336
@gnppro
gnppro / redundantAsyncAwait.js
Created January 13, 2020 22:20
Disallows unnecessary return await (no-return-await)
const asyncFunction = async () => {
const response = await fetch("https://pokeapi.co/api/v2/pokemon/ditto/");
// don't be redundant: return await response.json();
return response.json();
};
const myFunction = async () => {
const res = await asyncFunction();
console.log("res", res);
};
@gnppro
gnppro / cloudSettings
Last active January 29, 2020 18:56
VSCode My Config Sync
{"lastUpload":"2020-01-29T18:56:50.092Z","extensionVersion":"v3.4.3"}

IP for connect to localhost in same WiFi

  • ifconfig | grep "inet " | grep -v 127.0.0.1

Add PATH to .zshrc

  • echo -n 'export PATH=~/bin:$PATH' >> ~/.zshrc
  • echo -n 'export PATH=$HOME/bin:$PATH' >> ~/.zshrc

curl

  • curl [options] [URL...]