Skip to content

Instantly share code, notes, and snippets.

View disouzam's full-sized avatar
🚲

Dickson Souza disouzam

🚲
View GitHub Profile
@disouzam
disouzam / counting-files.sh
Created October 29, 2023 22:56
Counting files with a given word using bash
#! /bin/bash
file=./folder1/folder2/file-name-input.txt
outputfile=./folder1/folder2/file-name-output.txt
while IFS= read -r cmd; do
NUMBER_OF_FILES=$(grep --include=\*{ts,tsx} -rl './folder1' -e "$cmd" | wc -l)
printf 'Number of ocurrences: %s - Key: %s\n' "$NUMBER_OF_FILES" "$cmd" >> $outputfile
@disouzam
disouzam / .bashrc
Last active October 25, 2024 00:47
Bash configuration
# set -o xtrace
# https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Red 1;31
# Purple 0;35 Light Purple 1;35
# Brown 0;33 Yellow 1;33
@disouzam
disouzam / AutoStopWatch.cs
Created October 10, 2023 01:05
File with two classes that implement StopWatches
// Reference:
// https://stackoverflow.com/questions/3903222/measure-execution-time-in-c-sharp
// Answer by https://stackoverflow.com/users/435383/katbyte
using System;
using System.Diagnostics;
using System.Threading;
namespace Diagnostic
{
@disouzam
disouzam / SettingHEADBackToMain.md
Created October 1, 2023 19:25
Setting HEAD back to main
@disouzam
disouzam / VSCode-Extensions
Created August 23, 2023 11:51
List of current used VS Code extensions
https://marketplace.visualstudio.com/items?itemName=formulahendry.dotnet-test-explorer
https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel
https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-themes
https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp
https://marketplace.visualstudio.com/items?itemName=wmaurer.change-case
https://marketplace.visualstudio.com/items?itemName=adpyke.codesnap
@disouzam
disouzam / sonarscanner.windows.bat
Created December 30, 2022 12:08
Sample batch script to run SonarScanner locally
@REM In order to execute sonar coverage, you'll need to have sonarqube community downloaded and running local on your machine
@REM and sonarscanner installed as well and placed its /bin folder as a PATH ENVIRONMENT VARIABLE.
@REM Additionaly, you need to provide a Project TOKEN and set its value on LOGIN parameter (line 7).
set project="PLACE PROJECT NAME HERE"
set login="PLACE YOUR TOKEN HERE"
set host=http://localhost:9000
@disouzam
disouzam / stryker-config.json
Created December 24, 2022 03:01
Sample stryker-config.json .NET project
{
"stryker-config": {
"additional-timeout": 20000,
"baseline": {},
"concurrency": 4,
"coverage-analysis": "perTest",
"disable-bail": false,
"disable-mix-mutants": false,
"ignore-methods": [],
"ignore-mutations": [],
@disouzam
disouzam / pre-commit-hook.sh
Created December 24, 2022 02:57
Pre commit hook
#!/bin/sh
BLUE='\033[0;34m'
RED='\033[0;31m'
NOCOLOR='\033[0m'
# Check if the version of pre-commit hook was updated in version control
# since it is not possible to version control the actual pre-commit script
original_pre_commit_hook=".git/hooks/pre-commit"
pre_commit_hook_in_version_control=".git-hooks-for-reuse/pre-commit"
@disouzam
disouzam / remove-bin-obj.bat
Created December 24, 2022 02:54
Remove bin and obj folders using batch script
@echo off
@echo ======================================================
@echo {mainProjectName} - Remove bin and obj folders
@echo ======================================================
@echo off
@echo.
@echo.
cd ..\
md log
@disouzam
disouzam / settings.json
Last active October 21, 2024 17:45
Base settings.json for dotnet projects with variable for branch coverage threshold
{
"configuration": "release",
"{projectName}.branchCoverage.threshold": 100,
"debug.terminal.clearBeforeReusing": true,
"terminal.integrated.automationProfile.windows": {
"path": "C:\\Windows\\System32\\cmd.exe"
},
"files.exclude": {
"**/bin": true,
"**/obj": true,