Skip to content

Instantly share code, notes, and snippets.

@jordanfarrer
jordanfarrer / Calculate-MovieDuration.ps1
Created October 16, 2015 15:31
Calculates total duration of movies within a directory
$totalSeconds = 0
$wmp = New-Object -ComObject wmplayer.ocx
ls {{movieDirectoryPathHere}} -Recurse -Filter *.m4v | %{
$movie = $wmp.newMedia($_.FullName)
$totalSeconds += $movie.duration
}
Write-Host "$totalSeconds seconds."
@jordanfarrer
jordanfarrer / ps-set-reset-dns
Created July 9, 2015 17:25
PowerShell Set/Reset DNS
# This will give a list of interfaces (along with index)
Get-DnsClient
Set-DnsClientServerAddress -InterfaceIndex <Interface Index> -ServerAddresses ("<IP Address>", "<IP Address 2>")
Set-DnsClientServerAddress -InterfaceIndex <Interface Index> -ResetServerAddresses
@jordanfarrer
jordanfarrer / Full_Database_Backup_Script
Created November 22, 2014 15:55
Full Database Backup Script
DECLARE @BackupPath nvarchar(512) = '<Directory Path of Destination Folder>'
DECLARE @BackupName nvarchar(512) = '<Name of Backup File>'
DECLARE @FullBackupPath nvarchar(512) = @BackupPath + '\' + @BackupName + '.bak'
BACKUP DATABASE <Database Name>
TO DISK = @FullBackupPath
WITH FORMAT,
MEDIANAME = @BackupName,
NAME = '<Backup Name>'
-- REMEMBER: Add the SQL Server user to be able to write to the destination directory
@jordanfarrer
jordanfarrer / Web.config for State Server
Created October 10, 2013 20:27
The necessary elements in a web.config to use a ASP.NET State Server instead of the default InProc mode.
<system.web>
<sessionState
mode="StateServer"
stateConnectionString="tcpip=localhost:42424"
cookieless="false"
timeout="120" />
</system.web>
@jordanfarrer
jordanfarrer / .woff MIME type web.config fix
Created October 2, 2013 16:41
Prevent messages in the Chrome debugger for .woff fonts when served from IIS
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>