Skip to content

Instantly share code, notes, and snippets.

View zailleh's full-sized avatar

Tim Caldwell zailleh

View GitHub Profile
@zailleh
zailleh / ArchiveFileServer.ps1
Created February 22, 2013 04:36
This script takes your command-line input for the root source and dest. folders and will copy (archive) any files older than the $days specified. By doing it folder by folder (not using the recursive parameter and piping results to copy individual files) we build a relatively small list of files and process those before moving to the next folder…
################################################################################
# FILE ARCHIVING SCRIPT #
#*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*&&*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*#
# AUTHOR: Tim Caldwell DATE: 22/02/2013 #
# DESCRIPTION: #
# This script takes your command-line input for the root source and dest. #
# folders and will copy (archive) any files older than the $days specified #
################################################################################
################################################################################
@zailleh
zailleh / Create-ADUser
Last active May 16, 2022 04:59
Automated AD User Account Creation
<#
.SYNOPSIS
Creates new users via PIPS K2
.DESCRIPTION
This script takes input from variables given to it by K2 and creates
a new user to Lion spec
.PARAMETER <paramName>
$firstName - First name of the New Starter
$lastName - Last name of the New Starter
$middleName - Middle Name of the New Starter
<###############################################################################
Import-ADSites
################################################################################
DEPENDENCIES: Powershell Module - ActiveDirectory
SQL Access to referenced SQL server and Database
DESCRIPTION: Adds new AD Sites to LANSweeper and schedules a scan of
their IP subnets.
  CHANGE LOG:
@zailleh
zailleh / Service-WiFi-LAN-Autoswitch.ps1
Last active May 4, 2018 01:50
Script to be compiled into a Service that will automatically switch off Wi-Fi when an Ethernet connection is detected and switch it back on when no Ethernet connection is detected.
#"Running" | Out-File "C:\Temp\Service.log" -append
Do {
#"Start Of Loop" | Out-File "C:\Temp\Service.log" -append
$Adaptors = Get-WmiObject -query "SELECT * FROM Win32_NetworkAdapter WHERE PhysicalAdapter = 1 AND NOT Description LIKE '%Virtual%' AND (NetConnectionID LIKE '%Wireless Network Connection%' OR NetConnectionID LIKE '%Local Area Connection%' OR NetConnectionID LIKE '%Wi-Fi%' OR NetConnectionID LIKE '%Ethernet%')"
$NetEnabledAdaptors = @($Adaptors | Where {$_.NetEnabled -eq $true}).Count
#"Adaptors Found: $($Adaptors.Count)" | Out-File "C:\Temp\Service.log" -append
#"Net Enabled Adaptors: $NetEnabledAdaptors" | Out-File "C:\Temp\Service.log" -append
if ($NetEnabledAdaptors -gt 1)
{
#"WiFi and LAN Connected. Disabling WiFi..." | Out-File "C:\Temp\Service.log" -append
@zailleh
zailleh / Export-ADUserImages.ps1
Last active May 4, 2018 01:48
Powwershell script that will extract Active Directory user Thumbnail Images to files. Output directory is the only parameter. Will use your local/default domain controller & domain.
################################################################################
# AD PROFILE PICTURE EXTRACTOR #
################################################################################
# THIS SCRIPT WILL GET THE thumbnailPhoto ATTRIBUTE FROM ACTIVE DIRECTORY USER #
# AND SAVE TO JPEG #
# #
# AUTHOR: TIM CALDWELL #
# DATE: 21/02/2014 #
################################################################################
param(
@zailleh
zailleh / example.js
Created June 16, 2018 08:38
array.push example.js
//create empty array of bank accounts
let bankAccounts = []
// function to create a new account
const addAccount = function( name, amount ) {
// create new account object
let newAccount = {
accountName: name,
balance: amount
// sum shopping cart items js
// shopping cart object
const cartForParty = {
banana: "1.25",
handkerchief: ".99",
Tshirt: "25.01",
apple: "0.60",
nalgene: "10.34",
proteinShake: "22.36"
@zailleh
zailleh / GLaDOS_Shell.sh
Last active June 18, 2018 11:41
Script for printing a random welcome message from GLaDOS
################################################################################
# GLaDOS SHELL Welcome Messages!
################################################################################
# Colours Variables
RESET="\033[0m"
BOLD="\033[1m\e[38;5;214m"
ORANGE="\e[38;5;208m"
# FUN GLaDOS QUOTES!!!
echo "${BOLD}Initialising GLaDOS...${RESET}"
@zailleh
zailleh / atm.js
Last active June 24, 2018 09:04 — forked from ellijayne/atm bank js
atm bank html
$(document).ready(function() {
const balance = {
savings: 0,
checking: 0
};
//CHANGING COLOR ON $0...
const zeroBalance = function() {
if (balance['savings'] === 0) {
@zailleh
zailleh / short-tic-tac-toe-any-size-board.js
Created June 29, 2018 08:48
Made a tic-tac-toe game in js and jquery that will work at any size board in as few lines as possible
// <input type="range" id="size" min="3" max="10" value="3">
// <div class="board">
// </div>
let p = 0;
const s = [];
let size = +$('#size').val() //set size to default
const makeBoard = function() {
size = +$('#size').val() //get size from input