Skip to content

Instantly share code, notes, and snippets.

View mtslucasmartins's full-sized avatar
🍻

Lucas Martins mtslucasmartins

🍻
View GitHub Profile
# https://stackoverflow.com/questions/18394147/recursive-sub-folder-search-and-return-files-in-a-list-python
import os
def scandir(dir, ext = []): # dir: str, ext: list
subfolders, files = [], []
for f in os.scandir(dir):
if f.is_dir():
subfolders.append(f.path)
@mtslucasmartins
mtslucasmartins / pull-request-template.txt
Last active May 25, 2021 14:00
Pull Request Template
**Tipo**: Dúvida
----------
xxx
---
**Tipo**: Melhoria
**Impacto**: Baixo
**Valor**: Manutenibilidade do código
----------

Docker Protip #1

# Dockerfile-flask

# We simply inherit the Python 3 image. This image does
# not particularly care what OS runs underneath
FROM python:3

# Set an environment variable with the directory
# where we'll be running the app
@mtslucasmartins
mtslucasmartins / cordova-firebase-push-notifications.md
Last active April 9, 2020 14:12
Adding Push Notification In Your Cordova Application Using Firebase.

1. Configuration and preparation of the iOS environment

Certificates, IDs & Profiles > Identifiers > App IDs

We now need to fill out the followings:

  • App ID Description — Name. Here, you should put your app’s name (e.g. Firebase Notification Demo)

  • App ID Suffix — Explicit App ID — Bundle ID. Here, you need to select a unique bundle identifier for your app (e.g. com.possible.firebasenotificationsdemo). Please make sure you use your own bundle ID instead of using mine.

SSL Certificate - GoDaddy + Springboot.

The first thing you have to do is buy SSL certificates from GoDaddy.

For issuing SSL certificates, we need to submit CSR(Certificate Signing Request) which is a block of encoded information required by CA (Certificate Authority) to issue SSL certificate.

For more information please look into the following link: https://www.sslshopper.com/what-is-a-csr-certificate-signing-request.html

@mtslucasmartins
mtslucasmartins / apns-pem.md
Last active March 23, 2020 15:47
Creating PEM File por APNs.

Development Phase:

Step 1: Create Certificate .pem from Certificate .p12

  $ openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12

Step 2: Create Key .pem from Key .p12

@mtslucasmartins
mtslucasmartins / disable-multiple-form-submits-with-vanilla-javascript.md
Last active March 12, 2020 12:50
Disable Multiple Form Submits with Vanilla JavaScript

Earlier this week I was helping a colleague write some vanilla JavaScript to prevent a form from being submitted multiple times by an overzealous button clicker. The solution needed to be some framework-free JavaScript code. Thankfully this is pretty simple to do, so I thought I’d share some of the options here.

The example code included below is aimed at modern browsers (a minimum of IE10), but I’ve included comments for those needing IE9 support or lower. It’s depressing that in 2017 we’re still having to consider browsers from over five years ago, but sometimes this is necessary. If in doubt about browser support I’d recommend consulting the MDN website.

Disable the Submit Button

The simplest thing to do is disable the submit button the first time the form is submitted so the button cannot be clicked again. We do this by listening for the form being submitte

YML para colocar S4 no ar;

buckets:
    
    - bussola-contabil:        
        name: bussola-contabil
 root: /buckets/ 

Now that you know when to use a Keytool self signed certificate, let's create one using a simple Java Keytool command:

  1. Open the command console on whatever operating system you are using and navigate to the directory where keytool.exe is located (usually where the JRE is located, e.g. c:\Program Files\Java\jre6\bin on Windows machines).

  2. Run the following command (where validity is the number of days before the certificate will expire):

 $ keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 
@mtslucasmartins
mtslucasmartins / Levenshtein.java
Created December 4, 2019 20:03
Java's Levenshtein Algorithm
public class Levenshtein {
static int calculate(String lhs, String rhs) {
int len0 = lhs.length() + 1;
int len1 = rhs.length() + 1;
// the array of distances
int[] cost = new int[len0];
int[] newcost = new int[len0];