Skip to content

Instantly share code, notes, and snippets.

@dkittell
dkittell / FTP-UploadDirectory.ps1
Created November 24, 2015 18:13
PowerShell – FTP Upload Directory With Sub-Directories
clear
# FTP Server Variables
$FTPHost = 'ftp://192.168.1.1/html/'
$FTPUser = 'user'
$FTPPass = 'password'
#Directory where to find pictures to upload
$UploadFolder = "C:\Temp\"
@dkittell
dkittell / PictureRename.ps1
Last active August 21, 2024 14:30
PowerShell – Rename Pictures to Image Taken Date/Time with Dimensions
<#
.SYNOPSIS
Renames pictures.
.DESCRIPTION
The Rename-Pictures cmdlet to rename pictures to a format where the file creation time is first
in the name in this format: . The idea is that
.PARAMETER Path
Specifies the path to the folder where image files are located. Default is current location (Get-Location).
@dkittell
dkittell / UpdateDateTime.bat
Last active November 30, 2015 12:45
Windows Batch - Update Date/Time
cls
date 11-27-2013
time 5:19:00 PM
w32tm /config /syncfromflags:manual /manualpeerlist:"time.windows.com"
net stop w32time
net start w32time
w32tm /resync
w32tm /resync
pause
@dkittell
dkittell / SMSSend.cs
Created December 1, 2015 12:33
C# - Windows Phone 8 - SMS Via Program
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Windows.Phone.Speech.Recognition;
using Windows.System;
@dkittell
dkittell / Get-NTPDateTime.ps1
Created December 3, 2015 18:21
PowerShell - Get/Set Windows Date/Time from NTP
<#
Majority of code is from:
Chris Warwick, @cjwarwickps, August 2012
chrisjwarwick.wordpress.com
#>
$sNTPServer = 'pool.ntp.org'
function Get-NTPDateTime ([string] $sNTPServer)
{
@dkittell
dkittell / Get-IIS_Sites_With_App_Pool.ps1
Created December 14, 2015 13:38
PowerShell – List Sites with App Pool
Import-Module WebAdministration
clear
$sites = @{Expression={$_.Name};Label="Site Name"}, ` @{Expression={$_.applicationPool};Label="Site App Pool";}, ` @{Expression={$_.PhysicalPath};Label="Site Physical Path";}
dir IIS:\Sites | Format-Table $sites -AutoSize
# List File Path for web.config files
ForEach($item in (dir IIS:\Sites))
@dkittell
dkittell / Get-TinyURL
Created December 14, 2015 17:55
Create TinyURL within PowerShell
clear
Function Get-TinyURL {
#PowerShell - Get-TinyURL API Call
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[String]
$sHTTPLink
)
if ($sHTTPLink.StartsWith("http://") -eq $true -or $sHTTPLink.StartsWith("https://") -eq $true)
@dkittell
dkittell / Get-RSS.ps1
Created December 15, 2015 19:55
PowerShell - RSS Feed Reader
clear
$rssFeedURL = 'http://www.kittell.net/feed/'
$rssFeed = 1(New-Object System.Net.WebClient).DownloadString($rssFeedURL)
$rssFeed.rss.channel.item | Select-Object title, link -First 5 | Format-Table -AutoSize
@dkittell
dkittell / PHP-DynamicBreadcrumbs.php
Last active July 21, 2022 18:59
PHP - Dynamic Breadcrumbs
<?php
// Credit goes to Dominic Barnes - http://stackoverflow.com/users/188702/dominic-barnes
// http://stackoverflow.com/questions/2594211/php-simple-dynamic-breadcrumb
// This function will take $_SERVER['REQUEST_URI'] and build a breadcrumb based on the user's current path
function breadcrumbs($separator = ' &raquo; ', $home = 'Home')
{
// This gets the REQUEST_URI (/path/to/file.php), splits the string (using '/') into an array, and then filters out any empty values
$path = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
@dkittell
dkittell / Get-REST.ps1
Created December 22, 2015 12:27
PowerShell - REST Client
param (
[Parameter( Mandatory=$true)]
[string]$Address
)
clear
function Get-MAC() {
param($Address)
begin {
$APIURL = "http://<URL>/address.xml?&search="
$resource = "$($APIURL)$($Address)"