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-process node ` | |
| select id,starttime,name, | |
@{ Name="CommandLine"; | |
Expr={ $filter = "ProcessId = {0}" -f $_.Id; (Get-CimInstance Win32_Process -filter $filter).CommandLine }} ` | |
| ? {$_.CommandLine -match ' gulp\.js Build_'} ` | |
| sort starttime ` | |
| ft -au -wr | |
# Omit the filter on gulp.js for a fuller result. |
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
# Old log file cleanup | |
cd C:\ProgramData\Sisense\PrismWeb\Logs | |
ls *.log.* ` | |
| ? {$_.Extension -match '^\.[0-9]+$' } ` | |
| ? {$_.LastWriteTime -lt (Get-Date).AddMonths(-1)} ` | |
| rm -vb | |
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
# Skip short files (assumed error outputs), files that contain "already begin built". | |
# Parse timestamp out of filename (YYYY-MM-DD-HHMMSS). | |
# Drop first component of "cube name" (the "Build_" part of "Build_Cube_Name") | |
ls *-2022-09-*.txt ` | |
| ? {$_.Length -gt 1000} ` | |
| ? {-not (sls -list 'already being built' $_)} ` | |
| sls "Finished '(.*)' after (([0-9\.]+) [a-zA-Z]+)" ` | |
| sel -fir 1000 ` | |
| sel @{Name="Timestamp";Expr={if ($_.Filename -match "(?<timestamp>20\d+-\d+-\d+-\d+)") {$Matches.timestamp} else {""}}} ` |
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
cd N:\SisenseBuilds\Elasticubes | |
ls */*.xml ` | |
| % {[xml] $xml = cat $_; | |
# $xml | gm | |
$xml.Cloud["Cloud.Tables"].Tables.CloudTable ` | |
| % { | |
# $_ | gm | |
[PSCustomObject] @{ | |
Server = $_["CloudTable.ConnectionProperties"].SqlServerConnectionProperties.Server; | |
Database = $_["CloudTable.ConnectionProperties"].SqlServerConnectionProperties.Database |
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
# From https://morgantechspace.com/2015/09/convert-sid-to-username-using-powershell.html#:~:text=SecurityIdentifier%20in%20Windows%20PowerShell%20script,to%20security%20identifier%20(SID). | |
$SID ='S-1-5-21-1924530255-1943933946-939161726-500' | |
$objSID = New-Object System.Security.Principal.SecurityIdentifier($SID) | |
$objUser = $objSID.Translate([System.Security.Principal.NTAccount]) | |
Write-Host "Resolved user name: " $objUser.Value |
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
ls jquery* -rec | sls 'jquery.*\b(v[1-9]+(\.[0-9]+(\.[0-9]+)?)?)' | select Filename,@{Name="Version";Expr={ $_.Matches[0].Groups[1].Value}},Path,@{Name="Line";expr={if ($_.Line.Length -gt 1024) { $_.Line.Substring(0,1024)} else {$_.Line}}} | ogv |
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
from sympy import * | |
# import numpy as np # Doesn't mix super-well w/sympy | |
from sympy.plotting import plot # According to https://stackoverflow.com/questions/71519021/what-is-the-difference-between-matplotlib-and-sympy-plotting-module, | |
# sympy.plotting is an abstraction layer over matplotlib, and is preferred for symbolic stuff. | |
# import matplotlib.pyplot as plt | |
init_printing() | |
from sympy.vector import CoordSys3D, Vector, matrix_to_vector as m2v | |
N = CoordSys3D('N') | |
t = symbols('t') |
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
# ls *.xml | % {[xml] $xml = cat $_; $xml.Cloud["Cloud.Tabls"].Tables.CloudTable | % { [PSCustomObject] @{ Server = $_["CloudTable.ConnectionProperties"].SqlServerConnectionProperties.Server; Database = $_["CloudTable.ConnectionProperties"].SqlServerConnectionProperties.Database}}} | |
ls .\*.xml ` | |
| % {[xml] $xml = cat $_; # Cast to [xml] magically parses XML text into an XmlElement (document). | |
# $xml | gm # Then you just have to navigate the various children and attributes. | |
$xml.Cloud["Cloud.Tables"].Tables.CloudTable ` | |
| % { | |
# $_ | gm | |
[PSCustomObject] @{ # Cast to [PSCustomObject] "magically" turns a hash into an object w/hash key-value pairs as properties. | |
Server = $_["Clou |
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
$mb = 1024*1024 | |
$days60 = (Get-Date).AddDays(-60) | |
ls | ? {($_.Length -gt 180*$mb) -and ($_.LastWriteTime -lt $days60)} | |
# Can pipe above cmd to 'rm -vb' |
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
foreach ($mach in @($env:COMPUTERNAME,"p8sismnweb03s","p8sismnbld01s","p8cstweb01d","p8cstweb01p")) { | |
Write-Host -fore cyan $mach | |
icm $mach {get-date} | |
} |