Skip to content

Instantly share code, notes, and snippets.

View dionimercado's full-sized avatar
😀
Working on my future

Dioni Mercado dionimercado

😀
Working on my future
View GitHub Profile
@dionimercado
dionimercado / GoogleAuthenticationCurl.sh
Created June 13, 2022 23:43 — forked from LindaLawton/GoogleAuthenticationCurl.sh
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
@dionimercado
dionimercado / .docker\Dockerfile
Created May 25, 2022 13:19 — forked from DanRibbens/.docker\Dockerfile
docker-compose & dockerfile for PHP 7.4, Nginx, PostgreSQL
FROM php:7.4-fpm
# Copy composer.lock and composer.json
COPY ../composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@dionimercado
dionimercado / next_nginx.md
Created August 23, 2021 21:43 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt
// load the AWS SDK
const AWS = require('aws-sdk')
// load CloudFront key pair from environment variables
// Important: when storing your CloudFront private key as an environment variable string,
// you'll need to replace all line breaks with \n, like this:
// CF_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIE...1Ar\nwLW...2eL\nFOu...k2E\n-----END RSA PRIVATE KEY-----"
const cloudfrontAccessKeyId = process.env.CF_ACCESS_KEY_ID
const cloudFrontPrivateKey = process.env.CF_PRIVATE_KEY
const signer = new AWS.CloudFront.Signer(cloudfrontAccessKeyId, cloudFrontPrivateKey)
@dionimercado
dionimercado / fuzzy-search.sql
Created August 29, 2020 23:18 — forked from lsauer/fuzzy-search.sql
FullText fuzzy searching in SQL / MySQL
#lo sauer, 2013 - www.lsauer.com
#see: http://www.lsauer.com/2013/05/mysql-fuzzy-searching-fulltext-queries.html
#Note: In MySQL SUBSTRING, the string-index starts at position 1
SELECT * FROM tablename
WHERE SOUNDEX(tablename_field)
LIKE CONCAT('%',SUBSTRING(SOUNDEX('Fuzti serch derm'),2),'%');
@dionimercado
dionimercado / autoload-models.js
Created April 1, 2020 07:56 — forked from zoozalp/autoload-models.js
Auto-loading mongoose models in node.js
/**
* Create an index.js file in the same directory as your models. Add this code to it. Be sure to add the necessary fs require
*/
var fs = require('fs');
// initializes all models and sources them as .model-name
fs.readdirSync(__dirname).forEach(function(file) {
if (file !== 'index.js') {
var moduleName = file.split('.')[0];
@dionimercado
dionimercado / docker_wordpress.md
Created October 21, 2019 12:13 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@dionimercado
dionimercado / docker-help.md
Created October 21, 2019 12:13 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@dionimercado
dionimercado / success.txt
Created February 7, 2018 14:25
I created this Gist with cURL!
Yay, cURL!