Skip to content

Instantly share code, notes, and snippets.

View karoltheguy's full-sized avatar

Carol Ouellet karoltheguy

View GitHub Profile
@karoltheguy
karoltheguy / custom_macvlan.sh
Last active June 5, 2022 20:13
macvlan seen by host
#!/usr/bin/env bash
#Change these variables!
NIC_NAME="eth0"
DOCKER_ROUTING_INTERFACE_NAME="mymacvlan"
DOCKERNETWORK_IP_ADDRESS="192.168.0.249/32"
DOCKERNETWORK_IP_RANGE="192.168.0.64/26"
sleep 15 #Do not rush things if executing during boot. This line is not mandatory and can be removed.
@karoltheguy
karoltheguy / portqury.ps1
Created May 6, 2022 18:20
Remote Port Query by Powershell
#$RemoteServer = Read-Host "Please provide destination to test"
$DestinationHost = ""
$SourceServers = "" #for multi servers: "server1", "server2", "server3"
$PortList = "443" #for multi ports: "80, 443, 566"
$PortType = "TCP"
$localportqry = "`"E:\RPA Tools\PortQryUI\PortQry.exe`""
$PortArray = @()
if ($PortType -eq "UDP") { $PortCmd = "-p UDP" } Else { $PortCmd = "-p TCP" }
@karoltheguy
karoltheguy / On Shutdown Event.xml
Created November 15, 2021 16:28
Task Scheduler action on Shutdown
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2021-11-15T11:01:07.6898855</Date>
<Author>Carol Ouellet</Author>
<URI>\Backup Files</URI>
<Description>Launch a task before rebooting/poweroff. This can be useful for task to be performed before Windows Update force reboot the PC</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
@karoltheguy
karoltheguy / add_usb_device.sh
Created November 15, 2021 02:22
Add Sonoff Zigbee USB Dongle to linux (Cygnal Integrated Products, Inc. CP210x Composite Device)
mknod /dev/ttyUSB0 c 188 0
insmod /usr/local/modules/usbserial.ko
insmod /usr/local/modules/cp210x.ko
@karoltheguy
karoltheguy / disablepreviewhover.ps1
Created August 20, 2021 22:10
Delay/Disable the Window taskbar preview. Sets it to milliseconds delay.
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ExtendedUIHoverTime -Value 20000
@karoltheguy
karoltheguy / containsfullmonth.cs
Last active October 16, 2021 01:16
Detect if date contains at least a full month (1st to last day of month)
using System;
public class Program
{
public static void Main(string[] args)
{
DateTime start = new DateTime(2020, 12, 15);
DateTime end = new DateTime(2021, 1, 20);
System.Diagnostics.Debug.WriteLine(IsFullMonth(start, end));
System.Diagnostics.Debug.Close();
@karoltheguy
karoltheguy / ping.ps1
Created August 10, 2021 19:02
Powershell Ping
function Test-PSOnePing
{
<#
.SYNOPSIS
Sends a ping (ICMP) to a computer
.DESCRIPTION
Sends a ping (ICMP) to a computer
.EXAMPLE
@karoltheguy
karoltheguy / flow test.ps1
Created June 1, 2021 19:43
Test connections on a list of ports from a list of remote hosts
$serverlist = "localhost", "127.0.0.1" #hosts to test FROM
$target = "google.ca"
$portlist = 8199, 8198, 8197
Write-Host "Target: $target"
foreach ($s in $serverlist) {
Write-Host "--------------------------"
Invoke-Command -ComputerName $s -ScriptBlock {
foreach ($p in $Using:portlist) {
$connection = Test-NetConnection -ComputerName $Using:target -Port $p
@karoltheguy
karoltheguy / ListenPort.ps1
Created May 1, 2021 18:13
Listening to port in powershell
function Listen-Port ($port=80){
<#
.DESCRIPTION
Temporarily listen on a given port for connections dumps connections to the screen - useful for troubleshooting
firewall rules.
.PARAMETER Port
The TCP port that the listener should attach to
.EXAMPLE
@karoltheguy
karoltheguy / leave RDP.bat
Created April 28, 2021 20:28
Exit RDP and modify the session to a "console" type
@echo off
for /f "tokens=3 usebackq" %%s in (`query user ^ | find /i "%username%"`) do (tscon %%s /dest:console /password:xxx)