Skip to content

Instantly share code, notes, and snippets.

View jdkang's full-sized avatar

Jaigene Kang jdkang

View GitHub Profile
function Is-Default-Branch {
return "%teamcity.build.branch.is_default%" -eq "true"
}
function Set-TeamCity-Parameter($name, $value) {
Write-Host "##teamcity[setParameter name='$name' value='$value']"
}
if (Is-Default-Branch) {
$releaseNumber = "%octopus.master.releaseNumber%"
# --- NETSH Capture - Circular Logging EXAMPLE ---
Netsh trace start scenario=NetConnection capture=yes report=yes traceFile=C:\%computername%_NetTrace.etl
# netmon can open .etl files
# http://blogs.technet.com/b/yongrhee/archive/2012/12/01/network-tracing-packet-sniffing-built-in-to-windows-server-2008-r2-and-windows-server-2012.aspx
# for public networks etc
persistent=yes
@jdkang
jdkang / reboot_reasons
Created March 8, 2015 14:47
Windows Powershell
Get-EventLog System | Where-Object {$_.EventID -eq "1074" -or $_.EventID -eq "6008" -or $_.EventID -eq "1076"} | ft Machinename, TimeWritten, UserName, EventID, Message -AutoSize -Wrap
HTTP requests
tshark -Y "http.request or http.response" -Tfields -e ip.dst
DNS
tshark -Y "dns.flags.response == 1" -Tfields -e frame.time_del
x509
tshark -Y "ssl.handshake.certificate" -Tfields -e ip.src -e x509sat.
nearby wifi
@jdkang
jdkang / apppools.ps1
Created June 2, 2015 16:49
IIS Settings in Powershell
<#
set-alias appcmd "C:\windows\SysWOW64\inetsrv\appcmd.exe"
& appcmd list apppool /xml | appcmd set apppool /in /autoStart:true /startMode:AlwaysRunning
& "C:\windows\SysWOW64\inetsrv\appcmd.exe" list apppool /xml | appcmd set apppool /in /recycling.periodicRestart.time:00:00:00
& "C:\windows\SysWOW64\inetsrv\appcmd.exe" list apppool /xml | appcmd set apppool /in "/+recycling.periodicRestart.schedule.[value='00:00:00']"
#>
@jdkang
jdkang / dsacls.bat
Created June 18, 2015 11:41
Allow AD Group to Join Computer to Domain
dsacls "CN=$UNNUMB$lastSTRING,$PATHDN" /G "$JOINGROUPDN:CA;Reset password" "$JOINGROUPDN:CA;Send as" "$JOINGROUPDN:CA;Receive as" "$JOINGROUPDN:CA;Change password" "$JOINGROUPDN:CA;Allowed to authenticate" "$JOINGROUPDN:WP;Account restrictions" "$JOINGROUPDN:WS;Validated write to service principal name" "$JOINGROUPDN:WS;Validated write to DNS host name" "$JOINGROUPDN:GR"
@jdkang
jdkang / cmderbootstrap.ps1
Created October 9, 2015 03:06
cmder bootstrap
$downloadUrl = (Invoke-RestMethod 'https://api.github.com/repos/bliker/cmder/releases').assets.browser_download_url | ? { $_ -like '*.7z' } | select -first 1
$tmpFileName = [system.io.path]::GetTempFileName()
(new-object net.webclient).DownloadFile($downloadUrl,$tmpFileName)
@jdkang
jdkang / setmon.ps1
Created January 27, 2016 04:47
Turn Monitor Off (Soft)
set-alias setmon Set-Monitor
function Set-Monitor {
param(
[Parameter(Mandatory=$true)]
[ValidateSet('on','off','lowpower')]
[string]$state
)
$signature = @"
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr PostMessage(int hWnd, UInt32 hMsg, Int32 wParam, Int32 lParam);
@jdkang
jdkang / userChrome.css
Created February 8, 2017 21:45
UserChrome VimFx
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/*
PUT ME IN $env:appdata\Mozilla\Firefox\Profiles\{profile}\chrome\userChrome.css
*/
/* *************************************
VimFx
************************************* */
/* Allow file:/// prefix for testing using `gulp {help,hints}.html`. */
@-moz-document url(chrome://browser/content/browser.xul), url-prefix(file:///)
{
@jdkang
jdkang / EventResponseProject.ps1
Last active March 24, 2017 20:37
octopus service healthcheck
#---------------------------------------------
# func
#---------------------------------------------
function Test-ServiceSettings {
param(
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
[Alias('name')]
[string]$ServiceName,
[Parameter(Mandatory=$false)]
[int]$ResetPeriod = 3600,