Skip to content

Instantly share code, notes, and snippets.

View gabriel-vanca's full-sized avatar

Gabriel Vanca gabriel-vanca

View GitHub Profile
@asheroto
asheroto / Create-NewOutlookEmail.ps1
Last active July 7, 2024 00:19
Create e-mails in Outlook using PowerShell. Select account, keep default signature, keep original formatting, produce valid HTML.
function Create-NewOutlookEmail {
param (
[Parameter(Mandatory = $true)]
[string]$To,
[Parameter(Mandatory = $true)]
[string]$Subject,
[Parameter(Mandatory = $true)]
[string]$Body, # Expecting HTML formatted string
@XenoPanther
XenoPanther / Windows ReFS versions.en.md
Last active June 11, 2025 15:18 — forked from 0xbadfca11/00_README.md
Windows ReFS versions

Version number is reported by fsutil fsinfo refsinfo, available on Windows 10 and Windows Server 2016.

ReFS 1.1

  • Version of formatted by Windows Server 2012.
  • Version 1.1 is used already in Windows Server 8 Beta. I have never seen version 1.0.
  • Can use and store alternate data streams, when mount on 8.1/2012 R2 or later.

ReFS 1.2

  • Version of formatted by Windows 8.1, Windows 10 v1507 to v1607, Windows Server 2012 R2, and when specified ReFSv1 on Windows Server 2016 or later.
  • Cannot use alternate data streams, when mount on 2012.
@indented-automation
indented-automation / Watch-WinEvent.ps1
Created July 13, 2022 19:07
Event log subscriber
function Watch-WinEvent {
<#
.SYNOPSIS
Watch for events matching a query in the event log.
.DESCRIPTION
Watch for events matching a query in the event log.
#>
@deadlydog
deadlydog / InvokeMethodWithRetries.cs
Created December 15, 2021 04:16
C# generic function to execute any function, retrying if an exception is thrown
public static T InvokeMethodWithRetries<T>(Func<T> method, int maxNumberOfAttempts = 5)
{
int numberOfAttempts = 0;
while (numberOfAttempts < maxNumberOfAttempts)
{
try
{
return method.Invoke();
}
catch (Exception ex)
@asheroto
asheroto / Extract-IP-Addresses-and-Count.ps1
Last active July 7, 2024 00:40
PowerShell script to extract IP addressees from a file and count the number of occurrences of each IP address.
function ExtractIPaddressesAndCount {
[CmdletBinding()]
param(
[Parameter(Position = 0, mandatory = $true)]
[string] $InputFile,
[Parameter(Position = 1, mandatory = $true)]
[string] $OutputFile
)
If (-Not(Test-Path -Path $InputFile -PathType Leaf)) {
@sinbad
sinbad / backup_gitea.sh
Created August 9, 2020 14:58
My Gitea Backup & Restore Scripts
#!/bin/bash
# `gitea dump` doesn't currently back up LFS data as well, only git repos
# It primarily backs up the SQL DB, and also the config / logs
# We'll backup like this:
# * "gitea dump" to backup the DB and config etc
# * tar / bzip all the repos since they will be skipped
# * Not rotated because git data is immutable (normally) so has all data
# * rsync LFS data directly from /volume/docker/gitea/git/lfs
# * No need for rotation since all files are immutable
@indented-automation
indented-automation / Export-EventLog.ps1
Created November 29, 2019 18:27
Export an event log to an evtx file.
function Export-EventLog {
<#
.SYNOPSIS
Export an event log to a saved event log file.
.DESCRIPTION
Export an event log, and it's messages, to a named event log file.
.EXAMPLE
Get-WinEvent -ListLog Application | Export-EventLog
@indented-automation
indented-automation / Send-Syslog.ps1
Created September 17, 2019 17:44
Send a message to a SysLog instance
function Send-Syslog {
param (
[Parameter(Mandatory, ValueFromPipeline)]
[String]$Message,
[String]$LogLevel = 'Information',
[Parameter(Mandatory)]
[IPAddress]$IPAddress,
@mutin-sa
mutin-sa / Top_Public_Time_Servers.md
Last active June 26, 2025 13:39
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@indented-automation
indented-automation / Get-CommandSource.ps1
Last active July 7, 2024 00:08
View the source for a command
function Get-CommandSource {
param (
[Parameter(Mandatory)]
[String]$Name
)
try {
$commandInfo = Get-Command $Name
if ($commandInfo -is [System.Management.Automation.AliasInfo]) {
$commandInfo = $commandInfo.ResolvedCommand