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 / SetDNS.sh
Last active September 6, 2024 11:24
#!/bin/sh
# SetDNS.sh
#
#
# Created by David Kittell on 6/14/19.
#
# Variables - Start
sExternalIPService="http://dns.kittell.net/ip.php"
@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 / UnixIdentification.sh
Last active March 7, 2024 13:44
Unix Identification is a script that originated with VMWare but I have added some other systems to the script.
#!/bin/bash
###############################################################################################
# PROGRAM: UnixIdentification.sh
# DESCRIPTION: Identify the UNIX operating system that you are on
#
# INITIAL CREDIT: UnixIdentification is a script that originated with VMWare but I have added
# some other systems to the script.
#
# Command line: bash UnixIdentification.sh
@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 / 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)));
# View current configuration
cat /etc/postfix/main.cf | grep inet_interfaces
# Backup current configuration to a date/time stamp formatted file
sudo cp /etc/postfix/main.cf /etc/postfix/main_`date +%Y_%m_%d_%H.%M.%S`.cf
# Make the change
sudo sed -i "s|inet_interfaces = all|inet_interfaces = 127.0.0.1|" /etc/postfix/main.cf
# Review the current configuration
@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 / adlists.list
Last active September 14, 2019 12:16
Ad Block Server URLs
http://hosts-file.net/ad_servers.txt
http://hosts-file.net/hphosts-partial.asp
http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts;showintro=0&mimetype=plaintext
http://someonewhocares.org/hosts/hosts
http://sysctl.org/cameleon/hosts
http://unbelovedhosts.apk.defim.de/hosts
http://winhelp2002.mvps.org/hosts.txt
http://www.malwaredomainlist.com/hostslist/hosts.txt
http://www.montanamenagerie.org/hostsfile/hosts.txt
@dkittell
dkittell / filter_stats.sh
Last active September 12, 2019 17:25
Pi-Hole Statistics
#!/bin/sh
# Pi-Hole Statistics
#
#
# Created by David Kittell on 3/21/17.
#
clear