Skip to content

Instantly share code, notes, and snippets.

View disouzam's full-sized avatar
🚲

Dickson Souza disouzam

🚲
View GitHub Profile
@disouzam
disouzam / python.json
Last active October 18, 2024 01:08
Python snippets for VS Code
{
// Place your snippets for python 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');",
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace FileAnalyzer
{
public class Record
{
public DateTime Start => DateTime.Parse(_line.Split(' ')[0]);
@disouzam
disouzam / deactivate
Created August 12, 2024 21:02 — forked from karrtikr/deactivate
Script to deactivate virtual environments for bash or zsh
# >>> Virtual env deactivate hook >>>
# Same as deactivate in "<venv>/bin/activate"
deactivate () {
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
# Long command with many parameters all on one line
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test Email" -Body "This is a test email." -SmtpServer "smtp.example.com" -Port 587 -UseSsl -Credential (Get-Credential) -Attachments "C:\path\to\file.txt" -Priority High -DeliveryNotificationOption OnSuccess, OnFailure
# Equivalent command using splatting for readability
$mailParams = @{
From = "[email protected]"
To = "[email protected]"
Subject = "Test Email"
Body = "This is a test email."
SmtpServer = "smtp.example.com"
@disouzam
disouzam / AddColumnIfNotExists.sql
Created May 7, 2024 17:21 — forked from davepcallan/AddColumnIfNotExists.sql
Add created_date column to all tables which don't have it already in SQL Server
SELECT 'ALTER TABLE ' + QUOTENAME(ss.name) + '.' + QUOTENAME(st.name) + ' ADD created_date DATETIME NULL;'
FROM sys.tables st
INNER JOIN sys.schemas ss on st.[schema_id] = ss.[schema_id]
WHERE st.is_ms_shipped = 0
AND NOT EXISTS (
SELECT 1
FROM sys.columns sc
WHERE sc.[object_id] = st.[object_id]
AND sc.name = 'created_date'
)
@disouzam
disouzam / better-git-branch.sh
Created February 14, 2024 12:21 — forked from schacon/better-git-branch.sh
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@disouzam
disouzam / bash-template.sh
Last active February 11, 2024 16:42
Header of bash script to log commands and line number
#!/bin/bash
set -o xtrace
PS4='${LINENO}: '
@disouzam
disouzam / .editorconfig
Created January 29, 2024 10:25 — forked from MelbourneDeveloper/.editorconfig
Directory.Build.props Enable All Errors
[*.{cs,vb}]
dotnet_diagnostic.CA1062.severity = none
# IDE0022: Use block body for method
csharp_style_expression_bodied_methods = true
# IDE0032: Use auto property
dotnet_style_prefer_auto_properties = true
#CSharpier Incompatible Rules
@disouzam
disouzam / palestrasg.md
Created January 29, 2024 01:12 — forked from giggio/palestrasg.md
Links da palestra sobre Roslyn Source Generators
<PropertyGroup>
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
</PropertyGroup>