Skip to content

Instantly share code, notes, and snippets.

@jangins101
jangins101 / Fiddler.Hide.CSS.Requests.js
Created June 15, 2016 12:08
Customization script addition for Fiddler to add a rule to hide CSS file requests
// Edit Fiddler rules (Rules => Customize Rules)
// Added this near the top of the script (one of the first things in the the "class Handlers" section)
public static RulesOption("Hide CSS requests")
BindPref("fiddlerscript.rules.HideCssRequests")
var m_HideCssRequests: boolean = false;
// Added this in the "OnBeforeResponse" method
if (m_HideCssRequests && oSession.uriContains(".css")) { oSession["ui-hide"] = "true"; }
@jangins101
jangins101 / Fiddler.Hide.JS.Requests.js
Created June 15, 2016 11:58
Customization script addition for Fiddler to add a rule to hide JS file requests
// Edit Fiddler rules (Rules => Customize Rules)
// Added this near the top of the script (one of the first things in the the "class Handlers" section)
public static RulesOption("Hide JS requests")
BindPref("fiddlerscript.rules.HideJsRequests")
var m_HideJsRequests: boolean = false;
// Added this in the "OnBeforeResponse" method
if (m_HideJsRequests && oSession.uriContains(".js")) { oSession["ui-hide"] = "true"; }
@jangins101
jangins101 / Get-DnsZoneRecords.ps1
Created May 25, 2016 14:54
Grab all the dns zones and their corresponding records and group it by zone name
$computer = $env:USERDNSDOMAIN;
# Get all the zones
$zones = @(Get-DnsServerZone -ComputerName $computer);
# Get records from each zone
$results = @{};
ForEach ($zone in $zones) {
Write-Host "$($zone.ZoneName)" -ForegroundColor Yellow -NoNewline;
@jangins101
jangins101 / SendToMonthlyReport.vba
Created April 27, 2016 18:29
VBA - Save a copy of an email to a monthly reports folder
' Copy the item(s) to the monthly report folder
Sub SaveToMonthlyReport()
' Gotta grab the MAPI namespace to get the folders
Set ns = Application.GetNamespace("MAPI")
Dim fldRoot As MAPIFolder
Set fldRoot = ns.GetDefaultFolder(olFolderInbox)
' Start with the root folder (create if necessary)
On Error GoTo ErrorHandlerFolderReports
Set fldReports = fldRoot.Folders("Monthly Reports")
@jangins101
jangins101 / Get-LocalUsersInfo.ps1
Created April 4, 2016 14:47
Get local users name, last login time and whether they are disabled or not
$([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{ $_.SchemaClassName -eq 'user' } | Select-Object @{l='name';e={$_.name}}, @{l='LastLogin';e={$_.lastlogin}}, @{l='IsDisabled';e={[bool]($_.userflags.value -band 0x2)}};
@jangins101
jangins101 / Powershell.Check-UserFlagsEnum.ps1
Last active March 6, 2024 15:56
Powershell - Check-UserFlagsEnum (ADS_USER_FLAG_ENUM)
function Check-UserFlagsEnum([int]$int) {
# REF: https://msdn.microsoft.com/en-us/library/windows/desktop/aa772300
$result = @();
$flags = @{
0x1 = @{Name = "ADS_UF_SCRIPT"; Description = "The logon script is executed. This flag does not work for the ADSI LDAP provider on either read or write operations. For the ADSI WinNT provider, this flag is read-only data, and it cannot be set for user objects."};
0x2 = @{Name = "ADS_UF_ACCOUNTDISABLE"; Description = "The user account is disabled."};
0x8 = @{Name = "ADS_UF_HOMEDIR_REQUIRED"; Description = "The home directory is required."};
0x10 = @{Name = "ADS_UF_LOCKOUT"; Description = "The account is currently locked out."};
0x20 = @{Name = "ADS_UF_PASSWD_NOTREQD"; Description = "No password is required."};
@jangins101
jangins101 / Update Namecheap DDNS
Last active April 19, 2023 23:26
Bash script for updating Namecheap DDNS IP address
#!/bin/sh
# Variables
LAST_IP_FILE=/tmp/lastip.txt
LOGFILE=/var/log/namecheap.log
TIME="`date +%Y-%m-%d:%H:%M`"
HOST=@
DOMAIN=example.com
PASSWORD=0123456789abcdef0123456789abcdef
echo "TIME: $TIME"
@jangins101
jangins101 / RunRule.bas
Created December 14, 2015 12:02
VBA script for Outlook to simplify running a single rule
' Rule execution
Sub RunRule(rulename As String)
Dim st As Outlook.Store
Dim myRules As Outlook.Rules
Dim rl As Outlook.Rule
Dim RunRule As String
Set st = Application.Session.DefaultStore
Set myRules = st.GetRules
@jangins101
jangins101 / MergeAndSaveIndividually.vba
Created December 1, 2015 12:29
This gist is a vba script that can be run on a mail merge document to take each merge and save it as an individual file. Would need to be customized for filename, but for most cases, it should be about 95% of the way there.
Sub MergeAndSaveIndividually()
' REF: http://stackoverflow.com/questions/12594828/how-to-split-a-mail-merge-and-save-files-with-a-merge-field-as-the-name
' Get desired save folder
'REF: http://www.mrexcel.com/forum/excel-questions/294728-browse-folder-visual-basic-applications.html
Dim fldr As FileDialog
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
@jangins101
jangins101 / Parsing IIS Logs with PowerShell
Created June 23, 2015 17:18
Parsing IIS Logs with PowerShell
#
# Originally from: "http://sbrickey.com/Tech/Blog/Post/Parsing_IIS_Logs_with_PowerShell"
#
# Define the location of log files and a temporary file
$LogFolder = "C:\inetpub\logs\LogFiles\W3SVC123"
$LogFiles = [System.IO.Directory]::GetFiles($LogFolder, "*.log")
$LogTemp = "C:\inetpub\logs\LogFiles\W3SVC123\AllLogs.tmp"
# Logs will store each line of the log files in an array