Skip to content

Instantly share code, notes, and snippets.

View sumitsaiwal's full-sized avatar

Sumit Kumar sumitsaiwal

View GitHub Profile
@sumitsaiwal
sumitsaiwal / tennis.py
Created June 17, 2020 07:45
Tennis Scoreboard Problem in Python.
input_list = []
while True:
input_str = input()
if input_str == "":
break
else:
input_list.append(input_str)
#print(input_list)
@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"
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 / 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:
@sumitsaiwal
sumitsaiwal / Docker for Windows: Shared Drives Issue.md
Last active June 26, 2019 13:13
Docker for Windows: Shared Drives Issue
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceAlias "vEthernet (DockerNAT)" -NetworkCategory Private
##keep this running for Decryption
while ($true)
{
 if ($(Get-SmbServerConfiguration).EncryptData)
@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 / introrx.md
Created February 5, 2018 05:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@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 / 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 / openssl cert azure vpn.md
Last active October 5, 2022 02:36
openssl certs for azure VPN

The sole dependency is a build of openssl for your platform. Without further due, our first step is to provide Azure with a certificate that will be used to sign client certificates. We call this the root certificate and by importing it to Azure we trust certificates signed by it. Most of the following commands will ask you to guard the output files with a passphrase, leave them empty until you have a working solution, then follow the guide again and add strong passwords when you’re asked to.

Generate CARoot private key

openssl genrsa -aes256 -out MyAzureVPN.key 2048

Generate a CARoot certificate valid for 10 years

openssl req -x509 -sha256 -new -key MyAzureVPN.key -out MyAzureVPN.cer -days 3650 -subj /CN="ca_name"

Note: fix for opesssl random number issue: openssl rand -out ~/.rnd -writerand ~/.rnd In Azure portal navigate to “Virtual Networks Gateway/Configuration/Point-to-site” and cert name and data from MyAzureVPN.cer removing '--Begin/end certificate'.