Skip to content

Instantly share code, notes, and snippets.

View fernandofig's full-sized avatar

Fernando Figueiredo fernandofig

  • Campinas, Brazil
View GitHub Profile
@fernandofig
fernandofig / CommandPrompts-WithWindowsTerminal.reg
Created February 15, 2023 02:35
Registry hack to create Explorer context menus that launch Windows Terminal on the selected folder. Requires Windows Terminal installed!
Windows Registry Editor Version 5.00
; This cleanup stuff usually fails due to restrictive permissions on these keys on the registry
; I'm leaving them here anyway for reference so you can set ownership to these keys for
; yourself, and then deleting them should work.
;
; Cleanup default context menu entries
[-HKEY_CLASSES_ROOT\Drive\shell\cmd]
[-HKEY_CLASSES_ROOT\Drive\shell\Powershell]
[-HKEY_CLASSES_ROOT\Drive\shell\WSL]
@fernandofig
fernandofig / RodaMinimz.vbs
Last active August 25, 2019 12:38
Run application with extended Windowing option (allowing for the window to be completely hidden - useful for terminal applications)
'Uso: RodaMinimz.vbs <TIPO_JANELA> <EXECUTAVEL> [OPCOES EXECUTAVEL]
' TIPO_JANELA:
' 0 Hides the window and activates another window.
' 1 Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
' 2 Activates the window and displays it as a minimized window.
' 3 Activates the window and displays it as a maximized window.
' 4 Displays a window in its most recent size and position. The active window remains active.
' 5 Activates the window and displays it in its current size and position.
' 6 Minimizes the specified window and activates the next top-level window in the Z order.
' 7 Displays the window as a minimized window. The active window remains active.
@fernandofig
fernandofig / packChanges.cmd
Created May 23, 2019 22:52
Script to be used with SourceTree to create a zip archive of files changed on a given (single) commit
@ECHO OFF
SET "PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin"
cd "%~2"
bash "C:\Program Files\Git\usr\bin\packChanges.sh" %1
EXIT 0
Get-AppxPackage -AllUsers <package query> | Remove-AppxPackage -AllUsers
Get-AppxPackage <package query> | Remove-AppxPackage
@fernandofig
fernandofig / SHA1Util.cs
Last active April 3, 2019 17:42 — forked from jchandra74/SHA1Util.cs
SHA1 Hash for Unicode string
//Forked from kristopherjohnson/SHA1Util.cs gist
using System.Security.Cryptography;
using System.Text;
namespace Snippets
{
public static class SHA1Util
{
/// <summary>
/// Compute hash for string encoded as UTF8, return as base64 encoded string
@fernandofig
fernandofig / CommandPrompts.reg
Last active October 19, 2023 22:43
Command Prompts (CMD & Powershell) Context Menu
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\01MenuCmd]
[-HKEY_CLASSES_ROOT\Directory\shell\cmd]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\01MenuCmd]
[-HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd]
[-HKEY_CLASSES_ROOT\Directory\shell\02MenuPowerShell]
[-HKEY_CLASSES_ROOT\Directory\shell\powershellmenu]
@REM !! ALTERE AS DUAS LINHAS ABAIXO PARA SE ADEQUAR SUAS NECESSIDADES !!
@SET "SEG=PE1"
@SET "EXT=txt"
@REM ******** NAO ALTERE NADA DAQUI PRA BAIXO! ********
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /R %%G IN (*.%EXT%) DO (
@fernandofig
fernandofig / pegaAmostra.cmd
Created May 30, 2018 23:13
Referência de uso de geração de pastas / arquivos com timestamp
@ECHO OFF
setlocal
FOR /F "tokens=1-4 delims=/:," %%a in ("%TIME%") do (set MYTIME=%%a%%b%%c%%d)
REM DEPENDENDO DE QUAL O IDIOMA OU COMO ESTIVER CONFIGURADO AS CONFIGURAÇÕES REGIONAIS DO WINDOWS, PODE SER NECESSÁRIO USAR A
REM PRIMEIRA OU SEGUNDA LINHA ABAIXO. COMENTE/DESCOMENTE A QUE FUNCIONAR MELHOR
SET TS=%date:~6,4%%date:~3,2%%date:~0,2%_%MYTIME%
@fernandofig
fernandofig / Model.Context.tt
Last active July 11, 2016 03:18
Useful extensions / helpers + t4 template to add ActiveRecord behavior for Entity Framework objects, and add DbContext persistent context (mainly for web requests)
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"PRDataModel.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
@fernandofig
fernandofig / uninstall-pkg.sh
Last active March 6, 2016 21:12
Quick and dirty script to remove .PKG installs on OSX
#!/bin/bash
SPECIALEXTLIST=(app action caction definition bundle kext prefPane plugin jdk fs framework)
function joinList { local IFS="$1"; shift; echo "$*"; }
function getListWithTerminators {
PROCLIST=()
for EXT in "${SPECIALEXTLIST[@]}"; do