Skip to content

Instantly share code, notes, and snippets.

Avatar
🐉

Fabrício Pinto Ferreira pferreirafabricio

🐉
View GitHub Profile
@pferreirafabricio
pferreirafabricio / canvasUtilities.js
Last active Jul 8, 2022
Class with some utilities to work on a canvas context
View canvasUtilities.js
/**
* Class with some utilities to work on a canvas context
* @author Fabrício Pinto Ferreira
*/
export class CanvasUtility {
/**
* @param {CanvasRenderingContext2D} newContext
*/
constructor(newCanvasContext) {
/** @type {CanvasRenderingContext2D} */
@pferreirafabricio
pferreirafabricio / global.json
Created Jun 22, 2022
Example of global.json file for configuring a dotnet core application to use the the latest dotnet core SDK version 3.1
View global.json
{
"sdk": {
"version": "3.1.0",
"rollForward": "latestFeature"
}
}
@pferreirafabricio
pferreirafabricio / .gitattributes
Last active Jun 4, 2022
Example o a .gitattributes file for correct identification of languages on GitHub
View .gitattributes
# Auto detect text files and perform LF normalization
* text=auto
*.cs linguist-language=csharp
*.csproj linguist-language=csharp
*.sln linguist-language=csharp
*.md linguist-detectable=true
*.md linguist-documentation=false
# And ignore those repositories considering them as documentation
View Speak-Powershell.ps1
<#
Usage example:
./Speak-Powershell.ps1 "Hy PowerShell"
#>
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$textToSpeak = switch ( [String]::IsNullOrEmpty($args[0]) ) {
$true { "Hello World" }
$false { $args[0] }
@pferreirafabricio
pferreirafabricio / Request.cs
Last active Jun 30, 2021
A simple C# script for making HTTP Request on Unity
View Request.cs
using System;
using System.Collections;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
namespace Project.Base
{
public static class Request
@pferreirafabricio
pferreirafabricio / convertImagesToBase64.ps1
Last active Jul 1, 2021
Script to loop through a folder with images and convert all of them to a Base64 string
View convertImagesToBase64.ps1
<#
Usage on Linux:
pwsh ./convertImagesToBase64.ps1 /home/user/folder/images
Usage on Windows:
./convertImagesToBase64.ps1 C:/Path/To/Imagens
#>
$folderPath = $args[0]
@pferreirafabricio
pferreirafabricio / png-to-base64.ps1
Last active Jul 1, 2021
Convert an image to a Base64 string with PowerShell (Updated 2021)
View png-to-base64.ps1
<#
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 use:
[String]$base64 = [convert]::ToBase64String((Get-Content $transactionImage.FullName -Encoding Byte))
#>
$pathToImage = "/home/user/development/image.png"
[String]$base64 = [convert]::ToBase64String((Get-Content $pathToImage -AsByteStream))
Write-Output $base64
@pferreirafabricio
pferreirafabricio / logger.js
Last active Jun 22, 2021
A simple logger script made with Winston package for NodeJS
View logger.js
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 {
View PostProcess-HeightFog.shader
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
View first-docker-compose.yml
version: "3.6"
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: mysecretpassword
wordpress:
image: wordpress
depends_on:
- db