Skip to content

Instantly share code, notes, and snippets.

View karoltheguy's full-sized avatar

Carol Ouellet karoltheguy

View GitHub Profile
@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)
@karoltheguy
karoltheguy / Wifi Adhoc.bat
Created April 17, 2021 18:17
Create a WIFI adhoc connection between two PCs
netsh wlan set hostednetwork mode=allow ssid=AdHocNetwork key=yourpassword
netsh wlan start hostednetwork
REM Then go enable the new hostednetwork network adapter
@karoltheguy
karoltheguy / HideRemovalIcon.bat
Created June 1, 2020 22:04
Hides the Safely remove Hardware icon which can be clicked on accidentally
Timeout /t 5
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray" /v "Services" /t reg_dword /d 29 /f
systray
@karoltheguy
karoltheguy / SortbyNumber.cs
Created August 20, 2019 15:51
C# Sort by number
List<string> list = new List<string>() {
"Liverpool - 1",
"Liverpool - 11",
"Liverpool - 12",
"Liverpool - 2",
"West Kirby - 1",
"West Kirby - 12",
"West Kirby - 8" };
var sortedList = list.CustomSort().ToArray();