This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
snippet for working in a nested structure and needing to access | |
data folders in the parent | |
""" | |
from pathlib import Path | |
parent = (Path.cwd()).parent | |
path_to_data = parent.joinpath("path", "to", "data") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all System Log Events that are "Error" or "Critical" level and | |
# save to an xml file (deserialize) | |
$filter = @{LogName="System"; Level=(1,2)} | |
Get-WinEvent -Filterhashtable $filter | | |
Export-CliXml -Path "$ENV:USERPROFILE\system_errors.xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Homebrew Script for OSX | |
# To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh` | |
echo "Installing brew..." | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
echo "Installing brew cask..." | |
brew tap homebrew/cask |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- XML Query Filter copied from | |
https://docs.microsoft.com/en-us/troubleshoot/windows-client/application-management/event-10016-logged-when-accessing-dcom | |
--> | |
<QueryList> | |
<Query Id="0" Path="System"> | |
<Select Path="System">*</Select> | |
<Suppress Path="System"> | |
*[System[(EventID=10016)]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smartsheet | |
API_KEY = 'Insert you API Key here' | |
smartsheet_client = smartsheet.Smartsheet(API_KEY) | |
# Get a list of the filters for a sheet | |
sheet_id = 123456789 # insert your sheet_id | |
sheet = smartsheet_client.Sheets.get_sheet(sheet_id, include=["filterDefinitions"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Must be connected to Exchange Online | |
# Gets all Quarantined messages from the last week | |
# Results are grouped by recipient | |
Get-MessageTrace -EndDate (Get-Date) -StartDate (Get-Date).adddays(-7) -Status Quarantined | | |
Sort-Object -Property RecipientAddress | | |
Format-Table -GroupBy RecipientAddress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a super **SIMPLE** example of how to create a very basic powershell webserver | |
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity. | |
# Http Server | |
$http = [System.Net.HttpListener]::new() | |
# Hostname and port to listen on | |
$http.Prefixes.Add("http://localhost:8080/") | |
# Start the Http Server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one-liner to copy text files in a directory and change the year from 2021-> 2022 in the file name. | |
# change file extension to suit | |
dir *.txt | | |
select -expandproperty fullname | | |
Copy-Item -Path $_ -Desination ($_).replace("2021","2022") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires EXO V2 | |
Get-ExoMailbox -PropertySets Quota -RecipientTypeDetails Usermailbox | | |
Select-Object -Property Identity,ProhibitSendQuota, ProhibitSendReceiveQuota, IssueWarningQuota | | |
Format-Table |