Skip to content

Instantly share code, notes, and snippets.

View disouzam's full-sized avatar
🚲

Dickson Souza disouzam

🚲
View GitHub Profile
@disouzam
disouzam / get-commit-url.sh
Created January 25, 2026 18:01
Get commit remote URL via command line using Bash
#!/bin/bash
function get_commit_url() {
echo "$(git config --get remote.origin.url)" | \
sed -e 's/git@/https:\/\//' -e 's/\.git$//' \
| awk -v sha="$(git rev-parse $1)" '{print $0"/commit/"sha}'
}
@disouzam
disouzam / inspect-git.sh
Created January 14, 2026 18:49
Script to use for tutorial purposes on Git
#!/bin/bash
# A script to inspect the current Git repository status and display relevant information.
file_name="files-in-git"
old_file="${file_name}_old.txt"
new_file="${file_name}.txt"
function generate_git_file_list() {
ls -1 -R .git > $1
}
@disouzam
disouzam / .gitignore
Last active January 12, 2026 12:21 — forked from Shivani-Gonde/BlogPost_Cu_Met_CA4Py_BP1_ProcessModel.rst
Cu Pyrometallurgy process model
custom_scripts/
.vscode/
pyproject.toml
poetry.lock
*.equi
*.cst
@disouzam
disouzam / github.py
Created January 1, 2026 01:23 — forked from lemire/github.py
Get your GitHub activity for 2025
#!/usr/bin/env python3
# uv run lemire.py --token <your_github_token> --user <github_username>
#
# To generate a GitHub Personal Access Token:
# 1. Go to https://github.com/settings/tokens
# 2. Click "Generate new token (classic)"
# 3. Give it a name, e.g., "GitHub Search Script"
# 4. Select scopes: For public repositories, select "public_repo". For private, select "repo".
# 5. Click "Generate token"
# 6. Copy the token and use it as --token argument.
@disouzam
disouzam / bash_strict_mode.md
Created December 11, 2025 10:41 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@disouzam
disouzam / latex.json
Last active December 13, 2025 14:56
VS Code code snippets
{
// Place your snippets for latex here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@disouzam
disouzam / dummy_block.csproj
Created November 14, 2025 13:53
Checking constants defined in C# project files
<Target Name="Debug check" BeforeTargets="Build">
<Exec Command="echo $(DefineConstants)" />
</Target>
@disouzam
disouzam / mutation-testing.sh
Created November 2, 2025 01:05
Mutation testing in Python using Cosmic Ray library
#!/bin/bash
# set -o xtrace
PS4='${LINENO}: '
source .venv/Scripts/activate
echo -e "Virtual environment: $VIRTUAL_ENV" && python --version
echo ""
cosmic-ray --verbosity=DEBUG baseline .vscode/cosmic-ray.toml
cosmic-ray --verbosity=DEBUG exec .vscode/cosmic-ray.toml .vscode/cosmic-ray.sqlite
@disouzam
disouzam / .bashrc
Last active October 24, 2025 23:34
Conditional loading of nvm in bash
export NVM_DIR="$HOME/.nvm"
# Timing functionality provided by this Unix Stack Exchange answer:
# https://unix.stackexchange.com/questions/52313/how-to-get-execution-time-of-a-script-effectively/52347#52347
function load_nvm() {
start=`date +%s`
echo 'Loading nvm...'
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"