Skip to content

Instantly share code, notes, and snippets.

View keyan1603's full-sized avatar

Karthikeyan Manickavasagam keyan1603

View GitHub Profile
@keyan1603
keyan1603 / powershellgist.ps1
Last active May 16, 2024 08:24
Kubernetes - Some useful Powershell commands
# Get into Windows Pod and access Powershell inside the pod
kubectl exec -it <podname> -- powershell
# To view the content inside a file, for example web.config
Get-Content web.config
# Get top 100 lines of the file
Get-Content web.config -First 100
# Get last 100 lines of the file
@keyan1603
keyan1603 / kubectlcommandsamples.ps1
Created September 20, 2023 18:12
Some useful Kubectl commands - Quick reference
# Display list of all contexts in the current machine
kubectl config get-contexts
# Display the current-context
kubectl config current-context
# Set the default context to my-cluster-name
kubectl config use-context <my-cluster-name>
# Get all the nodes
@keyan1603
keyan1603 / kubernetesLoggingExtend.config
Created September 20, 2023 18:09
Extending the default OOTB logging - Windows nodes
{
"LogConfig": {
"sources": [
{
"type": "EventLog",
"startAtOldestRecord": true,
"eventFormatMultiLine": false,
"channels": [
{
"name": "system",
@keyan1603
keyan1603 / kubernetesrevert.ps1
Created September 20, 2023 18:07
Revert to Previous release – Disaster recovery in Kubernetes
# Revert to previous deployment
kubectl rollout undo deployments/<deployment name>
#Example: To revert CD deployment to the previous state
kubectl rollout undo deployments/cd
# To get the Revisions which were deployed
kubectl rollout history deployment/<deployment name>
#Example: To get the Revision history of CM
kubectl rollout history deployment/cm
@keyan1603
keyan1603 / Sitecore.Reflection.Spefix.config
Last active September 20, 2023 18:05
Fix Sitecore SPE Receive-File modal in 10.x after patching Sitecore critical vulnerabilities
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:security="http://www.sitecore.net/xmlconfig/security/" xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore role:require="ContentManagement or Standalone">
<reflection>
<allowedMethods>
<descriptor type="Spe.Client.Applications.UploadFile.PowerShellUploadFileForm" methodName="CancelClick" assemblyName="Spe" hint="Cancel"/>
<descriptor type="Spe.Client.Applications.UploadFile.PowerShellUploadFileForm" methodName="OKClick" assemblyName="Spe" hint="Ok"/>
<descriptor type="Spe.Client.Applications.UploadFile.PowerShellUploadFileForm" methodName="StartUploading" assemblyName="Spe" hint="StartUploading"/>
<descriptor type="Spe.Client.Applications.UploadFile.PowerShellUploadFileForm" methodName="EndUploading" assemblyName="Spe" hint="EndUploading"/>
<descriptor type="Spe.Client.Applications.UploadFile.PowerShellUploadFile
@keyan1603
keyan1603 / UpdateWorkflow.ps1
Last active September 20, 2023 18:06
Sitecore SPE Script to update workflow states under specific node
Write-Host "Starting work in the context of the 'master' database, under /sitecore/content/website1/Data item."
Set-Location -Path "master:/sitecore/content/website1/Data"
# Set up variables
$workflowState1 = "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" #ID of the workflow states.
$workflowState2 = "{yyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy}"
$workflowState3 = "{zzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz}"
function Update-Workflows {