Skip to content

Instantly share code, notes, and snippets.

View lucasluizss's full-sized avatar
🗺️
Continuous learning...

Lucas Silva lucasluizss

🗺️
Continuous learning...
View GitHub Profile
const { JSDOM } = require('jsdom');
const { writeFileSync } = require('node:fs');
let csvContent = 'Código;Data do pagamento;Rendimento;Total\n';
let errorContent = '';
/**
* Fetch data from a URL and extract the value using XPath
* @param {*} param0
* @returns
@lucasluizss
lucasluizss / Pack-Projects.ps1
Created April 16, 2025 08:42
Script for helping with framework/library development. It will generate packages to a given version and folder and as an option it can also restore the generated packages in the target project. This is used mainly for testing a new framework code.
# How to run:
# .\Pack-Projects.ps1 -solutionPath "D:\Projects\AppFramework" -version "2.0.0"
# .\Pack-Projects.ps1 -solutionPath "D:\Projects\AppFramework" -version "2.0.0" -outputPath "D:\NuGetPackagesLocal" -targetProjectPath "D:\Projects\Template\server"
param(
[Parameter(Mandatory=$true)]
[string]$solutionPath,
[Parameter(Mandatory=$true)]
using System.Linq.Expressions;
using System.Reflection;
namespace Infrastructure.Extensions;
public static class DynamicSearchExtensions
{
public static IQueryable<T> DynamicSearch<T>(this IQueryable<T> query, string? searchTerm)
{
if (string.IsNullOrWhiteSpace(searchTerm))
{
@lucasluizss
lucasluizss / secure_update.sql
Last active August 2, 2024 13:50
SQL counting query update
-- Start a transaction
BEGIN TRANSACTION;
-- Select the initial count of employees
DECLARE @initialCount INT;
SELECT @initialCount = COUNT(*) FROM employees WHERE salary < 50000; -- Select that matches the update clasure
---------------------------------------------- Perform an update operation ----------------------------------------------
@lucasluizss
lucasluizss / terminal
Created July 17, 2024 22:18
Sonar Scanner
docker run --rm --link sonarqube \
-e SONAR_HOST_URL=$SONAR_HOST_URL \
-e SONAR_TOKEN=$SONAR_TOKEN \
-v "$PROJECT_PATH:/usr/src" \
sonarsource/sonar-scanner-cli \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.projectName="$SONAR_PROJECT_NAME" \
-Dsonar.projectVersion=$SONAR_PROJECT_VERSION \
-Dsonar.sources=$SONAR_SOURCES \
-Dsonar.sourceEncoding=$SONAR_SOURCE_ENCODING \
@lucasluizss
lucasluizss / util
Created July 8, 2024 12:00
Get image and transform to base64
async fetchImageBlob(url: string) {
const response = await fetch(url);
if (!response.ok) throw new Error('Failed to fetch image');
return response.blob();
}
// Helper function to convert blob to Base64
async convertBlobToBase64(blob: Blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
@lucasluizss
lucasluizss / .zshrc
Last active March 29, 2024 20:37
My configurations .zshrc
###########################################
########## Terminal configuration ##########
###########################################
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
export PATH="$PATH:$HOME/.gem/ruby/2.6.0/bin"
# Check if powerlevel10k is cloned and clone it if not
@lucasluizss
lucasluizss / heroku_dotnet
Created August 10, 2023 18:09
docker publish heroku
# Deploy no Heroku
# verificar se o heroku esta instalado
heroku --version
# Fazer login no Heroku
heroku login
# Entrar na pasta com dockerfile
@lucasluizss
lucasluizss / Microsoft.PowerShell_profile.ps1
Last active November 14, 2023 19:15
PowerShell_Profile
Import-Module posh-git
oh-my-posh --init --shell pwsh --config ~/oh-my-posh.omp.json | Invoke-Expression
Import-Module -Name Terminal-Icons
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource History
# F2 switches between ListView and LineView
Set-PSReadLineOption -PredictionViewStyle ListView
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowJs": true,
"outDir": "dist",
"rootDir": "src",
"baseUrl": "src",
"paths": {
"@config/*": ["config/*"],