Skip to content

Instantly share code, notes, and snippets.

View fmmendes's full-sized avatar
:octocat:
Working from home

Filipe Moraes Mendes fmmendes

:octocat:
Working from home
View GitHub Profile
@fmmendes
fmmendes / jdk_install.sh
Last active October 28, 2024 04:04
Custom script to download and install Oracle JDK from archive file
#!/bin/bash
# This is a custom script to download and install Oracle JDK from archive file
# Please note that this script was only tested only on:
# Raspberry Pi 5 running Raspberry Pi OS (64-bit) (Debian Bookworm port)
# This script is provided as is and you are free to use it at your own risk
# The author is not responsible for any damage caused by this script
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root with sudo -i command"

Configurar pom.xml do Maven para realizar build com as dependências

Exibe um pom.xml do Maven com as configuraçes para o Maven criar um arquivo FatJar.

@fmmendes
fmmendes / signing-vbox-kernel-modules.md
Created March 21, 2020 00:27 — forked from reillysiemens/signing-vbox-kernel-modules.md
Signing VirtualBox Kernel Modules

Signing VirtualBox Kernel Modules

These are the steps I followed enable VirtualBox on my laptop without disabling UEFI Secure Boot. They're nearly identical to the process described on [Øyvind Stegard's blog][blog], save for a few key details. The images here are borrowed from the [Systemtap UEFI Secure Boot Wiki][systemtap].

  1. Install the VirtualBox package (this might be different for your platform).
    src='https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo'
@fmmendes
fmmendes / sign-vbox-modules.sh
Created March 21, 2020 00:27 — forked from osule/sign-vbox-modules.sh
Virtualbox in a Fedora box
#!/bin/bash
for modfile in /lib/modules/$(uname -r)/*.ko; do
echo "Signing $modfile"
/usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \
/root/module-signing/MOK.priv \
/root/module-signing/MOK.der "$modfile"
done
modprobe vboxdrv
@fmmendes
fmmendes / async-foreach.js
Created August 2, 2019 16:46 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@fmmendes
fmmendes / install-docker.md
Created July 1, 2019 13:19 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command
@fmmendes
fmmendes / loose_space_analysis.sql
Last active April 24, 2019 14:41
MySQL loose space analysis - Query to analyse the loose space on a database.
SELECT
CONCAT('`', TABLE_SCHEMA, '`.`', TABLE_NAME, '`') AS `OBJECT NAME`,
ROUND((DATA_LENGTH / 1024 / 1024), 2) AS `OBJECT SIZE (MB)`,
`RATIO`,
ROUND((DATA_FREE / 1024 / 1024), 2) AS `LOOSE SPACE (MB)`,
`DDL`
FROM
(
SELECT
TABLE_SCHEMA,
@fmmendes
fmmendes / download-file.js
Created April 15, 2019 03:35 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@fmmendes
fmmendes / gist:88706a4d024fd64117c9da1155f296a8
Created December 15, 2017 17:35 — forked from guisehn/gist:3276302
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;