Skip to content

Instantly share code, notes, and snippets.

DROP TABLE IF EXISTS #temp_tablelist
CREATE TABLE #temp_tablelist(
[table_name] [nvarchar](50) NOT NULL,
[rec] integer NOT NULL
)
DECLARE table_cursor CURSOR FOR
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
DECLARE @table_name AS NVARCHAR(50)
@pipin68k
pipin68k / Timetaken.ps1
Created December 14, 2014 13:08
Grouping Time Taken
Read-ApacheLog *.log|
?{($_.Status -eq 200) -and ($_.Path -like "*.php")}|
Group-Object Date|
%{
$m = $_ | select -ExpandProperty Group | measure -Property TimeTaken -Average -Maximum -Minimum
$_ | Add-Member Average $m.Average
$_ | Add-Member Max $m.Maximum
$_ | Add-Member Min $m.Minimum
$_
}|
@pipin68k
pipin68k / IIS7LogParser.psm1
Created September 27, 2014 02:11
IIS7 Log Parser for PowerShell
function Read-IIS7Log
{
param(
[Parameter(Mandatory=$true)]
[string]
$Path
)
Get-Content -Path $Path |
?{$_.ToString().StartsWith("#") -eq $false }|
% {
@pipin68k
pipin68k / Get-DirectorySize.psm1
Last active February 27, 2023 21:48
Get-DirectorySize
Function ConvertTo-HumanReadable([long] $size)
{
if($size -lt 0) { return "Failed" }
if($size -ge 1GB){
"{0,7:#,##0.0}G" -F ($size/1GB)
}elseif($size -ge 1MB){
"{0,7:#,##0.0}M" -F ($size/1MB)
}elseif($size -ge 1KB){
"{0,7:#,##0.0}K" -F ($size/1KB)