Skip to content

Instantly share code, notes, and snippets.

View mauleyzaola's full-sized avatar

Mauricio Leyzaola mauleyzaola

View GitHub Profile
@mauleyzaola
mauleyzaola / github_actions_golang.md
Created May 20, 2021 10:39 — forked from Harold2017/github_actions_golang.md
github actions golang, build, test, codecov

build

name: build
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
@mauleyzaola
mauleyzaola / How to Install JDK MacOS Homebrew.md
Created June 2, 2021 10:56 — forked from gwpantazes/How to Install JDK MacOS Homebrew.md
How to install different JDK versions on MacOS with Homebrew

How To Install Different JDK Versions on MacOS with Homebrew

Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version

This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.

Table of Contents

@mauleyzaola
mauleyzaola / jwtRS256.sh
Created July 23, 2021 23:27 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@mauleyzaola
mauleyzaola / iterate_pdf_content_python.md
Created June 9, 2022 06:37 — forked from somada141/iterate_pdf_content_python.md
Iterate over decoded PDF page content with Python

Introduction

This note shows how to iteratively retrieve the decoded content of the pages in a PDF file using Python and the pdfminer Python package.

At the time of writing, the latest version of pdfminer was used, i.e., 20140328. Thus, as the package seems poorly maintained and prone to API-breaking changes one may have to explicitly install this version for the following code to work.

Code

The following generator will iterate over a PDF file under a given filename and iteratively yield the text content of each PDF page:

@mauleyzaola
mauleyzaola / index.html
Last active September 9, 2022 04:22 — forked from iamsaso/index.html
GraphiQL with JWT
<!DOCTYPE html>
<html>
<head>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}
@mauleyzaola
mauleyzaola / getfriends_select.go
Created October 28, 2022 03:07 — forked from dragonsinth/getfriends_select.go
GetFriends using select
func GetFriends(ctx context.Context, user int64) (map[string]*User, error) {
g, ctx := errgroup.WithContext(ctx)
friendIds := make(chan int64)
// Produce
g.Go(func() error {
defer close(friendIds)
for it := GetFriendIds(user); ; {
if id, err := it.Next(ctx); err != nil {
if err == io.EOF {
@mauleyzaola
mauleyzaola / nginx-stat-failed-13-permission-denied.md
Created February 16, 2023 00:01 — forked from windsting/nginx-stat-failed-13-permission-denied.md
fix: Nginx: stat() failed (13: permission denied)

Nginx: stat() failed (13: permission denied)

from https://stackoverflow.com/questions/25774999/nginx-stat-failed-13-permission-denied

Nginx operates within the directory, so if you can't cd to that directory from the nginx user then it will fail (as does the stat command in your log). Make sure the www-user can cd all the way to the /username/test/static. You can confirm that the stat will fail or succeed by running

sudo -u www-data stat /username/test/static
@mauleyzaola
mauleyzaola / 2019-https-localhost.md
Created March 12, 2023 18:35 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@mauleyzaola
mauleyzaola / auth-hook.js
Created April 30, 2023 22:34 — forked from ulises-jeremias/auth-hook.js
Examples of hooks utils using axios, recoil.js, keycloak-js, @react-keycloak/web and more.
import { useCallback, useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import { useKeycloak } from '@react-keycloak/web';
import { commonNotification } from './common';
/**
* Returns the auth info and some auth strategies.
*
*/