Skip to content

Instantly share code, notes, and snippets.

View sumitsaiwal's full-sized avatar

Sumit Kumar sumitsaiwal

View GitHub Profile
@sumitsaiwal
sumitsaiwal / MoveResourceToDiffAzureSubscription.ps1
Created February 1, 2018 10:35
Moving Azure resources from one Subscription's resource group to another Subscriptions's resource group
#Login
Login-AzureRmAccount
#Variables
$oldSubscription = Read-Host 'oldSubscriptionID' #Name of source susbcription
$newSubscription = Read-Host 'newSubscriptionID' #Name of destination subscription
$sourceRG = Read-Host 'sourceRG' #Name of ource Resource Group
$destinationRG = Read-Host 'destinationRG' #Name of destinatino Resource Group
#Get resources
@sumitsaiwal
sumitsaiwal / MoveAzureResouces2diffRG.ps1
Created February 2, 2018 12:05
Moving Azure resources from one RG to another.
#Login
Login-AzureRmAccount
#Variables
$sourceRG = Read-Host 'sourceRG' #Name of source Resource Group
$destinationRG = Read-Host 'destinationRG' #Name of destinatino Resource Group
$Subscription = Read-Host 'SubscriptionName' #Name of Subscription
#Get resources
Select-AzureRmSubscription -SubscriptionName $Subscription
@sumitsaiwal
sumitsaiwal / introrx.md
Created February 5, 2018 05:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@sumitsaiwal
sumitsaiwal / connection_proxy
Created February 7, 2018 06:33
SSH through Proxy
## ssh connection behind proxy, requires netcat(nc) installed
ssh USER@FINAL_DEST -o "ProxyCommand=nc -X connect -x PROXYHOST:PROXYPORT %h %p"
@sumitsaiwal
sumitsaiwal / service principal for Azure Container Service
Last active March 2, 2018 01:36
Service principal for a Kubernetes cluster in Container Service using Azure CLI
##Connect to ACS##https://docs.microsoft.com/en-us/azure/container-service/dcos-swarm/container-service-connect
##Kubectl.exe: https://storage.googleapis.com/kubernetes-release/release/v1.9.3/bin/windows/amd64/kubectl.exe
##clientID==appId
##cleintPassword==password
az login
az account set --subscription "mySubscriptionID"
az group create --name "myResourceGroup" --location "westus"
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# region_name:
# - subnet-id or subnet_tag_name:
# - type: t2.micro
# image: image-tagname or AMI-Id
sudo sed -i 's/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
sudo sed -i 's/PasswordAuthentication no/#PasswordAuthentication no/g' /etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin yes' /etc/ssh/sshd_config
sudo sed -i '$ a PasswordAuthentication yes' /etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin without-password' /etc/ssh/sshd_config
echo PASSWORD | sudu passwd
sudo service ssh restart (ubuntu)
sudo service sshd restart (rhel)
@sumitsaiwal
sumitsaiwal / aws_ebs_volume_k8s
Created July 28, 2018 17:59
AWS EBS Volumes in Kubernetes
containers:
- name: APP_NAME
image: "DOCKER_IMAGE_NAME"
ports:
- name: http
containerPort: 3000
volumeMounts:
- name: share
mountPath: /var/lib/
volumes:
Driver Support Required:
1. Display
2. 3D hardware acceleration support
3. Audio
4. Webcam
5. Video-game controller
http://somatorio.org/en/post/running-gui-apps-with-docker/
https://blog.qmo.io/the-perfect-media-server-with-docker-plex-and-automatic-bittorrent/
@sumitsaiwal
sumitsaiwal / vsts_build_retain
Last active August 16, 2018 10:35
Retain VSTS build indefinitely
#import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common"
$uri = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECT/_apis/build/builds/$($env:BUILD_BUILDID)?api-version=2.0"
Write-Verbose "URI: $uri"
$body = "{keepForever:true}"
$result = Invoke-RestMethod -Uri $uri -Method Patch -ContentType "application/json" -Headers @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} -Body $body
Write-Output "RESULT: $result"