Skip to content

Instantly share code, notes, and snippets.

View jamiejohnsonkc's full-sized avatar

Jamie Johnson jamiejohnsonkc

View GitHub Profile
@jamiejohnsonkc
jamiejohnsonkc / Print Win Dir Tree
Last active August 11, 2018 01:35
Print Directory/File Trees #win #cmd
Open terminal in directory
enter tree
paste into desired text editor
@jamiejohnsonkc
jamiejohnsonkc / reclaimWindows10.ps1
Last active August 11, 2018 23:23 — forked from alirobe/reclaimWindows10.ps1
reclaimWindows10.ps1 #win, #cmd, #services, #batch
#This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.B. for a more secure baseline, refer to https://github.com/nsacyber/Windows-Secure-Host-Baseline
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.20.1, 2018-07-23
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
@jamiejohnsonkc
jamiejohnsonkc / service control commands
Created August 11, 2018 23:19
Service Control Commands #win, #cmd
Use the SC (service control) command, it gives you a lot more options than just start & stop.
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc <server> [command] [service name] ...
The option <server> has the form "\\ServerName"
Further help on commands can be obtained by typing: "sc [command]"
@jamiejohnsonkc
jamiejohnsonkc / net start & stop commands
Created August 11, 2018 23:22
net start / net stop #win, #cmd
net start [serviceName]
and
net stop [serviceName]
tell you whether they have succeeded or failed pretty clearly. For example
U:\>net stop alerter
The Alerter service is not started.
@jamiejohnsonkc
jamiejohnsonkc / Add more classes via page_template filter
Last active August 13, 2018 03:51
Add Body Class, #php, #wordpress
add_filter( 'body_class', 'custom_class' );
function custom_class( $classes ) {
if ( is_page_template( 'page.php' ) ) {
$classes[] = 'doh';
}
return $classes;
}
@jamiejohnsonkc
jamiejohnsonkc / conditional header tag
Created August 13, 2018 02:55
Conditional header tag, #php, #wordpress
if ( is_front_page() ) :
get_header( 'home' );
elseif ( is_page( 'About' ) ) :
get_header( 'about' );
else:
get_header();
endif;
@jamiejohnsonkc
jamiejohnsonkc / Remove inline body_class via filter
Created August 13, 2018 03:49
Remove body_class according to page_template #php, #wordpress
add_filter('body_class', function (array $classes) {
if (in_array('class-to-remove', $classes)) {
unset( $classes[array_search('class-to-remove', $classes)] );
}
return $classes;
});
@jamiejohnsonkc
jamiejohnsonkc / NetStat_Syntax
Created August 14, 2018 17:12
NetStat Syntax, #cli, #win, #Netstat, #ports
Windows Vista and later syntax
NETSTAT [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-x] [-t] [interval]
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or listening port. In some cases, well-known executables host multiple independent components, and in these cases, the sequence of components involved in creating the connection or listening port is displayed. In this case, the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.
-e Displays Ethernet statistics. This option may be combined with the -s option.
-f Displays Fully Qualified Domain Names (FQDN) for foreign addresses.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
-p proto Shows connections for the protocol specified by proto; proto may b
@jamiejohnsonkc
jamiejohnsonkc / nullfile_default_app_regedit
Created August 19, 2018 03:18
Nullfile default app registry tweak #win, #registry, # nullfile
(save the following as a .reg file and doubleclick. NOTE: edit opening app declaration)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.]
[HKEY_CLASSES_ROOT\.\shell]
[HKEY_CLASSES_ROOT\.\shell\open]
@jamiejohnsonkc
jamiejohnsonkc / Regex find everything
Created August 31, 2018 14:34
find EVERYTHING, #regex
Used in a regex search, this formula will find every instance of viewBox=" " regardless of the values contained therein
viewBox="(.*?)"