Skip to content

Instantly share code, notes, and snippets.

View pferreirafabricio's full-sized avatar
🔥

Fabrício Pinto Ferreira pferreirafabricio

🔥
View GitHub Profile
@pferreirafabricio
pferreirafabricio / backupMongoDatabase.ps1
Last active September 16, 2021 14:33
Create a backup in a .zip file with all collections of a MongoDB Database
#region Variables
<# Set the MongoDB access variables #>
$databaseName = "databaseName"
# $username = ""
# $password = ""
# $authenticationDatabase = ""
$mongoDbHost = "localhost:27017"
# $uri = ""
@pferreirafabricio
pferreirafabricio / game-dev-setup.sh
Last active December 3, 2020 15:30
Install generic and common tools for game development in Ubuntu 20.04
#!/bin/bash
# Author: Fabrício Pinto Ferreira
# This is a simple script that aims install generic and common tools
# for game development in Ubuntu 20.04
sudo apt update
echo 'Installing Snap...'
sudo apt install snapd
@pferreirafabricio
pferreirafabricio / createSystemScheduledTask.ps1
Last active December 6, 2020 00:15
Create a scheduled task that will run a PowerShell script at 1:00 AM, in this example a script that will make a backup of a MongoDB Database
$scriptToExecutePath = "C:\Path\To\dump-script.ps1";
$taskName = "MongoDB Backup - <databaseName>"
$taskDescription = "Make a dump of <databaseName> database"
$action = New-ScheduledTaskAction `
-Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' `
-Argument "-NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File $scriptToExecutePath"
$trigger = New-ScheduledTaskTrigger -Daily -At 1am
TypeScript 6 hrs 6 mins ████████████▉░░░░░░░░ 61.6%
PHP 1 hr 5 mins ██▎░░░░░░░░░░░░░░░░░░ 11.0%
C# 58 mins ██░░░░░░░░░░░░░░░░░░░ 9.8%
Other 54 mins █▉░░░░░░░░░░░░░░░░░░░ 9.2%
JSON 25 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.3%
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pferreirafabricio
pferreirafabricio / first-docker-compose.yml
Created April 14, 2021 01:19
🥳 My first docker compose
version: "3.6"
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: mysecretpassword
wordpress:
image: wordpress
depends_on:
- db
Shader "PostProcess/HeightFog"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_FogColor ("FogColor", Color) = (1,1,1,1)
_FogDensity ("FogDensity", Range(0,1)) = 0.2
_FogHeight ("FogHeight", float) = 5.0
}
SubShader
@pferreirafabricio
pferreirafabricio / logger.js
Last active June 22, 2021 18:23
A simple logger script made with Winston package for NodeJS
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, printf } = format;
const config = require('./config');
const isLogsEnabled = config.enableLogs;
/**
* Class to log in text files
*/
class Logger {
@pferreirafabricio
pferreirafabricio / png-to-base64.ps1
Last active March 30, 2024 15:44
🖼 Convert an image to a Base64 string with PowerShell
<#
OBS:
The AsByteStream parameter was introduced in Windows PowerShell 6.0
If your PowerShell version (run `(Get-Host).Version` to find out) is lower than 6 then use the version for Powershell 5.1:
#>
$pathToImage = "/home/user/development/image.png"
# For Powershell 5.1
[String]$base64 = [convert]::ToBase64String((Get-Content $pathToImage -Raw -Encoding Byte))
@pferreirafabricio
pferreirafabricio / convertImagesToBase64.ps1
Last active March 30, 2024 16:03
Script to loop through a folder with images and convert all of them to a Base64 string
<#
Usage on Linux:
pwsh ./convertImagesToBase64.ps1 /home/user/folder/images
Usage on Windows:
./convertImagesToBase64.ps1 C:/Path/To/Imagens
#>
$folderPath = $args[0]