Skip to content

Instantly share code, notes, and snippets.

View jmelosegui's full-sized avatar

Juan Manuel Elosegui jmelosegui

View GitHub Profile
function Resolve-Error ($ErrorRecord=$Error[0])
{
$ErrorRecord | Format-List * -Force
$ErrorRecord.InvocationInfo | Format-List *
$Exception = $ErrorRecord.Exception
for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
{ "$i" * 80
$Exception | Format-List * -Force
}
}
Add-Type -AssemblyName System.Configuration
$fileMap = New-Object -TypeName System.Configuration.ExeConfigurationFileMap
$fileMap.ExeConfigFilename = "app.config"
$configurationUserLevelNone = 0
$config = [System.Configuration.ConfigurationManager]::OpenMappedExeConfiguration($fileMap, $configurationUserLevelNone)
$section = $config.GetSection("connectionStrings");

Keybase proof

I hereby claim:

  • I am jmelosegui on github.
  • I am jmelosegui (https://keybase.io/jmelosegui) on keybase.
  • I have a public key ASBPD3i2zMDoyI7xTA5byIbkSPge4cb6TyinON7-JTg3KAo

To claim this, I am signing this object:

@jmelosegui
jmelosegui / RunPowershellOnStartUp
Created August 17, 2020 13:12
This command creates a schedule task to run a powershell script on system startup.
schtasks /create /tn "Start Docker Containers" /sc onstart /delay 0000:30 /rl highest /ru system /tr "powershell.exe -file E:\ScheduledTasks\StartDockerContainers.ps1"
$folderToDelete = "E:\d\"
takeown.exe /F $folderToDelete /R /A /D Y
icacls $folderToDelete /T /C /grant Administrators:F
Remove-Item $folderToDelete -Recurse -Force
rundll32 dfshim CleanOnlineAppCache
@jmelosegui
jmelosegui / Get-InstalledSoftware.ps1
Created January 10, 2019 16:53
Retrieves a list of all software installed you can filter by name or guid
function Get-InstalledSoftware
{
<#
.SYNOPSIS
Retrieves a list of all software installed
.EXAMPLE
Get-InstalledSoftware
This example retrieves all software installed on the local computer
.PARAMETER Name
@jmelosegui
jmelosegui / VideoToGif
Last active September 30, 2018 15:46
convert video into a gif using docker and ffmpeg
docker run --rm --volume ${pwd}:/ourtput jmelosegui/ffmpeg -i output/video.mp4 /output/video.gif
@jmelosegui
jmelosegui / vs-code.json
Created March 8, 2018 20:23
Settings to use commander as me console application with in vscode
"terminal.external.windowsExec": "C:\\dev\\utils\\cmder\\Cmder.exe",
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows" : ["/K","C:\\dev\\utils\\cmder\\vendor\\init.bat"],
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$ConfigurationDataFile
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "SilentlyContinue"