Skip to content

Instantly share code, notes, and snippets.

Avatar

Clive Norman normansolutions

View GitHub Profile
View proxy.pac
function FindProxyForURL(url, host) {
// Your proxy server name and port
var proxy_yes = "PROXY proxylb.schoolsbroadband.net:31702";
var proxy_no = "DIRECT";
if (isInNet(myIpAddress(), "10.3.0.0", "255.255.0.0")) return proxy_no;
// DEFAULT RULE: All other traffic, send direct
return proxy_yes;
}
function FindProxyForURLEx(url, host) {
View ForceMachineRestart.ps1
Import-Module ActiveDirectory
$ou = "OU=Office Computers,Dc=CompanyName,Dc=Net"
Get-ADComputer -Filter * -SearchBase $ou |
ForEach-Object {
Restart-Computer -ComputerName $_.name -force
}
# If you wish to eliminate specific machines from this restart - no problem, you can add a "where" clause using a wildcard to either target an individual or complete OU.
View iSAMSFamilyList.sql
SELECT p.txtschoolid,
p.txtsurname,
p.txtforename,
A.txtcontactssurname,
A.txtcontactsforename,
AL.tblpupilmanagementaddresslinkid,
A.tblpupilmanagementaddressesid,
( '(' + Isnull(A.txtrelationtype, '') ) + ')' + Char(13) + Char(10) +
( Isnull(A.txtcontactstitle, '') + ' '
+ Isnull(A.txtcontactsforename, '') + ' '
@normansolutions
normansolutions / ExcelSplitSiblingName.vba
Created Sep 17, 2017
Quick & Dirty Basic Excel Macro To Split Coma Separated Cells Into Columns (ideal for iSAMS sibling exports)
View ExcelSplitSiblingName.vba
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
'Crude error handling!
On Error Resume Next
siblingNameField = InputBox("Please enter the heading for the sibling names")
If siblingNameField = Empty Then Exit Sub
siblingYearField = InputBox("Please enter the heading for the sibling year group")
If siblingYearField = Empty Then Exit Sub
@normansolutions
normansolutions / ExcelMacroTranspose.vba
Last active Jul 8, 2016
Excel Macro To Transpose Copy Paste Looping Through Timetable Data
View ExcelMacroTranspose.vba
Sub Copy()
NextLine = 1
TeacherLine = 0
Period = 1
For i = 4 To 46
Worksheets("Main").Range("B" & i & ":BI" & i).Copy
Worksheets("Result").Range("B" & NextLine).PasteSpecial Transpose:=True
For T = 1 To 60
If Period > 60 Then Period = 1
View DisableClutter.ps1
####Create an Office 365 session connection
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
###Use this Powershell script to disable Clutter across all accounts
Get-Mailbox | Set-Clutter -Enable $true
###Use this PowerShell script to disable Clutter for an individual (in this example "PTest")
View SecureHead.cshtml
@using System.Configuration;
@{
string ComplexURLFromWebConfig = ConfigurationManager.AppSettings["ComplexURLQueryString"].ToString().Trim();
@* QueryString sent from url *@
string QueryStringComplexURL = (Request.QueryString["ComplexURLQueryString"] ?? "").ToString().Trim();
View Web.config
<appSettings>
<add key="ComplexURLQueryString" value="hhqsdc332323vxzcjsdffbfsh12sdfdfgdfgdfgwerktyykfdhgdhjsdfsdfasdffdfww"/>
</appSettings>
View CreateCookie.cshtml
@{
String cookieQueryString = Request.QueryString["cookieSetter"];
switch (cookieQueryString)
{
@* QueryString "remove" - This deletes the cookie from the device *@
case "remove":
Response.Cookies["NSSecureMethodCookie"].Expires = DateTime.Now.AddYears(-30);
break;
@normansolutions
normansolutions / AccountLockOutNotification.ps1
Last active Aug 29, 2015
PowerShell Script To Notify When User Account Has Been Locked Out
View AccountLockOutNotification.ps1
########################################################################
# Please Configure the following variables - $smtpServer and $from
# Leave the $event and $body variables as they are
$smtpServer="YOUR SMTP SERVER"
$from = "SET FROM EMAIL ADDRESS"
$event = Get-EventLog -LogName Security -InstanceId 4740 -Newest 1
$body = $event.Message + "`r`n`t" + $event.TimeGenerated
########################################################################
Send-Mailmessage -smtpServer $smtpServer -from $from -to $from -subject "Account Lockout" -body $body -priority High
You can’t perform that action at this time.