Skip to content

Instantly share code, notes, and snippets.

View cpereira7's full-sized avatar

cpereira7

  • Portugal
View GitHub Profile
param(
[Parameter(Mandatory = $true)]
[string]$Root,
[switch]$Delete
)
$ErrorActionPreference = "Stop"
{
"howto": "Windows Terminal > Settings > Open JSON file. Add 'scheme' to the 'schemes' array and 'colorScheme' to 'profileDefaults'.",
"scheme": {
"name": "Fjord",
"background": "#171C21",
"foreground": "#DCE3EA",
"cursorColor": "#7FC8C2",
"selectionBackground": "#2B3A46",
"black": "#11161A",
"red": "#E07A7A",
# ==========================================================
# WSL DEVELOPER TOOLKIT
# Bash | Docker-focused | Minimal Git | Windows integration
# Add this section to the END of ~/.bashrc
# ==========================================================
# ----------------------------------------------------------
# 1. GENERAL NAVIGATION AND TERMINAL QUALITY-OF-LIFE
# ----------------------------------------------------------
@cpereira7
cpereira7 / clean-truecolor-prompt.sh
Created November 11, 2026 22:53
Minimalist TrueColor Bash prompt for WSL/Linux: hides user@hostname, auto-shortens home directory (~), and displays the current git branch with custom RGB colors.
parse_git_branch() {
git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null
}
set_prompt() {
local c_path="\e[38;2;217;119;87m"
local c_git="\e[38;2;224;180;103m"
local c_reset="\e[0m"
local branch=$(parse_git_branch)
@cpereira7
cpereira7 / Microsoft.PowerShell_profile.ps1
Created November 11, 2026 18:13
A PowerShell profile prompt that displays the current directory and Git branch with ANSI colors, and sets the terminal window title to the current folder.
function prompt {
$e = [char]27
$path = $executionContext.SessionState.Path.CurrentLocation.Path
$branch = git branch --show-current 2>$null
if (-not $branch -and $LASTEXITCODE -eq 0) {
$branch = git rev-parse --abbrev-ref HEAD 2>$null
}
$git = if ($branch) { " $e[38;2;224;180;103m($branch)$e[0m" } else { '' }
$host.UI.RawUI.WindowTitle = Split-Path $path -Leaf
"$e[38;2;217;119;87m$path$e[0m$git> "
param (
[Parameter(Mandatory=$true)]
[string]$source,
[Parameter(Mandatory=$true)]
[string]$destination
)
# Get all files to be copied
$files = Get-ChildItem -Path $source -Recurse -File
@cpereira7
cpereira7 / ListasLigadas.c
Created May 13, 2018 23:02
Antigo exercício de listas ligadas em C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _CRT_SECURE_NO_WARNINGS
struct cliente
{
int nif;
char nome[100];
/*
* Created by SharpDevelop.
* User: cpereira7
* C#, DataTable, Interfaces
*/
using System;
using System.Data;
namespace ReportGenerator
{
@cpereira7
cpereira7 / SQLPostgres.cs
Last active January 24, 2025 07:50
Select data from Postgres Database using Npgsql
/*
* Created by SharpDevelop.
* User: cpereira7
* Date: 08-11-2015
* Time: 20:06
* C#, Npgsql
*/
using System;
using System.Data;
using System.Diagnostics;
@cpereira7
cpereira7 / Csv2Doc.cs
Last active November 4, 2017 19:45
Permite criar vários documentos Word a partir de um template e substituição de campos por dados de um ficheiro CSV
using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using System.Diagnostics;
using System.Linq;
using Novacode;
namespace Csv2Doc
{