Skip to content

Instantly share code, notes, and snippets.

View Jackbennett's full-sized avatar

Jack Jackbennett

View GitHub Profile
@Jackbennett
Jackbennett / example_error.ps1
Created May 24, 2017 11:58
A waste of 10 minutes. Know what you're doing with try/catch
# By adding a credential parameter to my function I broke it and couldn't spot the fault for 10 mintues
# Rookie Mistake. Beware poor try/catch use.
try {
# Grab the events from a remote computer
$EventLog = Get-WinEvent -ComputerName $ComputerName -FilterHashtable -Credential:$Credential @{
Logname = 'Security';
Id = 4624;
StartTime = $StartDay.toShortDateString();
EndTime = $StopDay.toShortDateString();
} -ErrorAction Stop
@Jackbennett
Jackbennett / Remove.ps1
Last active February 7, 2017 10:55 — forked from anonymous/Remove.ps1
#Remove-MailQueueObjects.ps1
Param(
$Path = "D:\tst",
$pattern = "TextString",
$filter = "*.eml"
}
Get-ChildItem -Recurse -Path $Path -File -Filter $filter |
where {
get-content $psitem.fullname -ReadCount 0 |
@Jackbennett
Jackbennett / datetime.ps1
Created February 7, 2017 09:34
Convert datetime error
$ get-date -OutVariable sd "6/2/2017 03:58"
06 February 2017 03:58:00
$ $sd | gm
TypeName: System.DateTime
Name MemberType Definition
@Jackbennett
Jackbennett / stylish.css
Created September 16, 2016 12:12
16:9 is narrow enough why use more of it? Moves github header to the top right. Mouseover to see the search.
/**
Moves github header to the top right. mouseover to see the search.
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the whole CSS mentioned below.
3. Specify the domain name to be `github.com`.
4. Add a title and save.
*/
.header[role="banner"] {
jbennett $ $b
Username LogonTime ComputerName
-------- --------- ------------
usera 17/05/2016 14:16:15 U0xPC17
userb 17/05/2016 10:14:33 U0xPC17
userc 17/05/2016 09:22:08 U0xPC17
C:\f\src\music
Jack > git filter-branch -f --env-filter '
>> if [ "$GIT_COMMITTER_NAME" = "Jack Bennett" ];
>> then
>> GIT_COMMITTER_NAME="JackBennett";
>> GIT_AUTHOR_NAME="JackBennett";
>> fi
>>
>> if [ "$GIT_AUTHOR_NAME" = "Jack Bennett" ];
>> then
<Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><P
rovider Name='PowerShell'/><EventID Qualifiers='0'>800</EventID><Level>4</Level
><Task>8</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='20
15-09-18T13:37:43.000000000Z'/><EventRecordID>256</EventRecordID><Channel>Windo
ws PowerShell</Channel><Computer>U05PC02.BHS.INTERNAL</Computer><Security/></Sy
stem><EventData><Data>get-item .\test</Data><Data> DetailSequence=1
DetailTotal=1
SequenceNumber=29
pick 3189f68 Test relative links to subfolder in README
s 946106b Relative links to subfolder project in README
# Rebase 43130f3..946106b onto 43130f3 (2 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
@Jackbennett
Jackbennett / bastion
Last active September 6, 2015 21:19
AO Loot list reference
SSC Lootlist
x3 Inert Bacteriophage
x3 Pattern Conversion Device
x1 Virus Programming: Bacteriophage M73
x1 Virus Programming: Bacteriophage Phi X 3957
x1 Virus Programming: Bacteriophage F9
x1 Red Data Crystal
$dir
<#
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 4/22/2015 8:41 AM 1067 unameA - Shortcut.lnk
-a--- 4/22/2015 8:35 AM 1060 unameB - Shortcut.lnk
-a--- 4/22/2015 8:39 AM 1067 unameC - Shortcut.lnk
-a--- 4/22/2015 8:40 AM 1060 unameD - Shortcut.lnk
#>