Skip to content

Instantly share code, notes, and snippets.

@ykfq
ykfq / kubectl-get-taints
Last active Jul 28, 2020
Get the taints on all nodes in one command.
View kubectl-get-taints
root@master001:~# kubectl describe node | egrep "Taints"
Taints: gpu=yes:NoSchedule
Taints: <none>
Taints: <none>
Taints: <none>
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: <none>
Taints: <none>
@ykfq
ykfq / Kubernetes 调度优化--重平衡策略方案整理.md
Created Jan 29, 2019
Kubernetes 调度优化--重平衡策略方案整理
View Kubernetes 调度优化--重平衡策略方案整理.md
<title>Kubernetes 调度优化--重平衡策略方案整理</title>
@ykfq
ykfq / OpenWithSublimeText3.bat
Created Mar 18, 2017 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
View OpenWithSublimeText3.bat
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@ykfq
ykfq / latest-ffmpeg-centos6.sh
Created Mar 2, 2017 — forked from mustafaturan/latest-ffmpeg-centos6.sh
Installs latest ffmpeg on Centos 6
View latest-ffmpeg-centos6.sh
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@ykfq
ykfq / CheckAllDCsForGuid.ps1
Created Aug 9, 2016 — forked from bill-long/CheckAllDCsForGuid.ps1
Check every GC and DC for a specific objectGUID
View CheckAllDCsForGuid.ps1
$guid = "bc87047d-25e8-11d3-9079-00805f31f826"
$gcs = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs
$gcs | % {
$entry = [ADSI]("GC://" + $_.Name + "/<GUID=" + $guid + ">")
if ($entry.Guid -ne $null)
{
$entry
}
else
View Save-AllExchangeLogs.ps1
# Save-AllExchangeLogs.ps1
$timeString = (Get-Date).ToString("yyyyMMddHHmm")
$machineName = [Environment]::MachineName
$targetFolder = "$home\desktop\ExchangeLogs-$machineName-$timeString"
md $targetFolder | Out-Null
"Saving $targetFolder\Application.evtx..."
wevtutil epl Application "$targetFolder\Application.evtx"
"Saving $targetFolder\System.evtx..."
@ykfq
ykfq / Dump-MailboxSdAsSDDL.ps1
Created Aug 9, 2016 — forked from bill-long/Dump-MailboxSdAsSDDL.ps1
Dump msExchMailboxSecurityDescriptor as SDDL format. Useful if you need to inspect the raw ACL.
View Dump-MailboxSdAsSDDL.ps1
param($alias)
$searcher = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().FindGlobalCatalog().GetDirectorySearcher()
$searcher.Filter = "(mailnickname=$alias)"
$user = $searcher.FindOne()
$mbxSd = $user.Properties["msExchMailboxSecurityDescriptor"][0]
$sd = New-Object System.Security.AccessControl.RawSecurityDescriptor([byte[]]$mbxSd, 0)
$sd.GetSddlForm("All")
View Export-OnlyMailboxRoot.ps1
$path = '\\server\path\'
$mailboxes = get-mailbox somemailboxfilter
$mailboxes | % {
$folders = Get-MailboxFolderStatistics $_.Alias -archive
$folders = $folders | ? {$_.Name -ne "Top of Information Store"}
$excludeFolders = $folders | % { $_.FolderPath.Substring(1) }
New-MailboxExportRequest -Mailbox $_.Alias -ExcludeFolders $excludeFolders -ExcludeDumpster -IsArchive -FilePath ($path + $_.Alias + '.pst')
}
View ClearMoveFlags.ps1
$searcher = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().FindGlobalCatalog()
$searcher.Filter = "(&(objectClass=user)(msExchMailboxMoveFlags=10))"
$results = $searcher.FindAll()
"Found " + $results.Count.ToString() + " results:"
foreach ($result in $results)
{
$dn = $result.Properties["distinguishedName"][0].ToString()
$dn
$entry = [ADSI]("LDAP://" + $dn)
$entry.Properties["msExchMailboxMoveFlags"].Clear()
View SearchAllDCsForFilter.ps1
$filter = "(proxyAddresses=SMTP:foo@contoso.com)"
$gcs = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs
$gcs | % {
$searcher = $_.GetDirectorySearcher()
$searcher.Filter = $filter
$results = $searcher.FindAll()
if ($results.Count -gt 0)
{
$results
You can’t perform that action at this time.