Skip to content

Instantly share code, notes, and snippets.

; Launch console if necessary; hide/show on Win+`
#`::
DetectHiddenWindows, on
IfWinExist ahk_class Console_2_Main
{
IfWinActive ahk_class Console_2_Main
{
WinHide ahk_class Console_2_Main
; need to move the focus somewhere else.
WinActivate ahk_class Shell_TrayWnd
@mbrownnycnyc
mbrownnycnyc / uninstall_string_getter.ps1
Last active March 30, 2020 16:50
Still needs to be polished to do less work (proc arch conditional): for use with chocolatey packaging and to be included as a help within a warmUp template for use with chocolateyUnininstall.ps1... GetValueFromRegistryThruWMI modified version of http://gallery.technet.microsoft.com/scriptcenter/6062bbfc-53bf-4f92-994d-08f18c8324c0
$global:debug = $false
$global:debugverbose = $false
Function GetUninstallString([string]$computername, $displayname)
{
try {
#first, we'll grab a collection of key names below HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for 64 bit
#we'll search for the DisplayName...
#if found, we'll query for the UninstallString and we'll stop looking
write-host "Getting UninstallString. This may take a moment..." -backgroundcolor "DarkYellow"
@mbrownnycnyc
mbrownnycnyc / Microsoft.PowerShell_profile.ps1
Last active October 14, 2019 15:00
powershell profile
import-module powertab
Import-Module ActiveDirectory
Import-Module PSReadline
#thanks: http://serverfault.com/a/286003/88350
function Test-Credential {
<#
.SYNOPSIS
Takes a PSCredential object and validates it against the domain (or local machine, or ADAM instance).
@mbrownnycnyc
mbrownnycnyc / get_make_model.ps1
Last active December 25, 2015 21:49
quick script that queries the root of a domain for all computers that are XP and returns their make and model. You can use this list to grab the drivers for WDS and WAIK as noted in the URL linked embedded in the script.
<#
This is to assist with Windows OS deployments following the quick guide located:
http://blogs.technet.com/b/danstolts/archive/2010/03/11/deploy-windows-7-the-easy-way-using-wds-mdt-and-aik-step-by-step-video.aspx
1) query AD for all computers who are not disable, who have windows xp as an os
2) within loop:
`get-wmiobject -computername COMPUTER_NAME_HERE win32_computersystem`
3)
#>
@mbrownnycnyc
mbrownnycnyc / choco.xml
Created November 5, 2013 15:53
notepad++ powershell lexer for choco theme
<LexerType name="powershell" desc="PowerShell" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="C3BE98" bgColor="1A0F0B" fontName="" fontStyle="0" />
<WordsStyle name="COMMENT" styleID="1" fgColor="C3BE98" bgColor="1A0F0B" fontName="" fontStyle="0" />
<WordsStyle name="STRING" styleID="2" fgColor="8C7E3F" bgColor="1A0F0B" fontName="" fontStyle="0" fontSize="12" />
<WordsStyle name="CHARACTER" styleID="3" fgColor="C3BE98" bgColor="2D0F0B" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="NUMBER" styleID="4" fgColor="808080" bgColor="1A0F0B" fontName="" fontStyle="1" />
<WordsStyle name="VARIABLE" styleID="5" fgColor="ABA0C3" bgColor="2D0F0B" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="OPERATOR" styleID="6" fgColor="ABA0C3" bgColor="1A0F0B" fontName="" fontStyle="0" />
<WordsStyle name="INSTRUCTION WORD" styleID="8" fgColor="8000FF" bgColor="1A0F0B" fontName="" fontStyle="1" fontSize="
@mbrownnycnyc
mbrownnycnyc / httpd
Created November 25, 2013 20:59
/etc/init.d/httpd from a centos package...
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
@mbrownnycnyc
mbrownnycnyc / sysconfighttpd
Created December 3, 2013 21:26
httpd settings
# Configuration file for the httpd service.
#
# The default processing model (MPM) is the process-based
# 'prefork' model. A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
#HTTPD=/usr/sbin/httpd.worker
@mbrownnycnyc
mbrownnycnyc / iptables
Created December 5, 2013 18:51
base iptablesv4 for RHEL
#try: yum -y install system-config-firewall-tui
# system-config-firewall-tui
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
@mbrownnycnyc
mbrownnycnyc / iptables
Created December 5, 2013 20:59
more secure iptablesv4
# Generated by iptables-save v1.4.7 on Thu Dec 5 15:57:33 2013
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -i eth0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m multiport --dports 22,80,443 -m tcp -m state --state NEW,ESTABLISHED -j ACCEPT
@mbrownnycnyc
mbrownnycnyc / deployment.properties
Created January 16, 2014 15:54
JRE deployment.properties file
deployment.security.level=HIGH
deployment.security.level.locked
deployment.insecure.jres="PROMPT"
deployment.insecure.jres.locked
deployment.security.askgrantdialog.show=true
deployment.security.askgrantdialog.show.locked
deployment.security.askgrantdialog.notinca=true
deployment.security.askgrantdialog.notinca.locked
deployment.security.jsse.hostmismatch.warning=true
deployment.security.mixcode=ENABLE