Skip to content

Instantly share code, notes, and snippets.

View davoodharun's full-sized avatar
🎯
Focusing

Harun Davood davoodharun

🎯
Focusing
View GitHub Profile
@davoodharun
davoodharun / Leaflet.Arc.min.js
Last active February 23, 2016 00:33
D3 Visualization of Narendra Modi's Twitter network
!function(){if(!L)throw"Leaflet.js not included";if(!arc&&!arc.GreatCircle)throw"arc.js not included";L.Polyline.Arc=function(e,t,r){e=L.latLng(e),t=L.latLng(t);var n=100,c={};r&&(r.offset&&(c.offset=r.offset,delete r.offset),r.vertices&&(n=r.vertices,delete r.vertices));var l=new arc.GreatCircle({x:e.lng,y:e.lat},{x:t.lng,y:t.lat}),o=l.Arc(n,c),a=[];return o.geometries[0].coords.forEach(function(e){a.push(L.latLng([e[1],e[0]]))}),L.polyline(a,r)}}();
@davoodharun
davoodharun / gist:a1b433d587cb379cb9dff853e4b521aa
Created January 17, 2017 21:45
DSC error for sql always on cluster
[
{
"code": "ComponentStatus/DscConfigurationLog/failed/8",
"level": "Error",
"displayStatus": "Provisioning failed",
"message": "[2017-01-17T21:25:00] [VERBOSE] Operation 'Invoke CimMethod' complete.\r\n[2017-01-17T21:25:01] [VERBOSE] Set-DscLocalConfigurationManager finished in 5.573 seconds.\r\n[2017-01-17T21:25:04] [VERBOSE] Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.\r\n[2017-01-17T21:25:04] [VERBOSE] An LCM method call arrived from computer SQLSERVER-0 with user sid S-1-5-18.\r\n[2017-01-17T21:25:04] [VERBOSE] [SQLSERVER-0]: LCM: [ Start Set ]\r\n[2017-01-17T21:25:20] [ERROR] The WS-Management service cannot process the request. The WMI service or the WMI provider returned an unknown error: HRESULT 0x80041033 \r\n[2017-01-17T21:25:20] [VERBOSE] Operation 'Invoke CimMethod' complete.\r\n[2
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"addressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"description": "Address prefix for the Virtual Network"
}
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"addressPrefix": {
"value": "10.0.0.0/16"
},
"subnetPrefix": {
"value": "10.0.1.0/24"
},
@davoodharun
davoodharun / Execute-AzureDeploymentAutomationJob
Created February 15, 2017 15:09
Execute Azure Automation Job from Octopus Deploy
$clientId = $OctopusParameters['AzureGovernment.Account.ClientId']
$tenantId = $OctopusParameters['AzureGovernment.Account.TenantId']
$environmentName = $OctopusParameters['AzureGovernment.Account.EnvironmentName']
$key = $OctopusParameters['AzureGovernment.Account.KeyValue']
$subscriptionId = $OctopusParameters['AzureGovernment.SubscriptionId']
$automationAccountResourceGroupName = $OctopusParameters['AzureGovernment.Automation.AutomationAccountResourceGroupName']
$automationAccountName = $OctopusParameters['AzureGovernment.Automation.AutomationAccountName']
$runbookName = $OctopusParameters['AzureGovernment.AutomationRunbookName']
$targetResourceGroupName = $OctopusParameters['AzureGovernment.TargetResourceGroupName']
$templateResourceGroupName = $OctopusParameters['AzureGovernment.TemplateResourceGroupName']
@davoodharun
davoodharun / Execute-InitialSetup
Created February 15, 2017 15:14
Create storage account, automation account, key vault for automation with Octopus Deploy
#Script needs to be run with elevated priveleges, as it interacts with the local file system (for generation of a certificate)
#Executes the initial setup script, creating a dedicated resource group, storage account, and azure automation account.
#Optionally uploads arm templtes and pss runbooks to created storage account (if path specified)
#Optionally publishes all ps runbooks in specified directory to azure automation account created by the process.
& "$($PSScriptRoot)\Orchestration_InitialSetup.ps1" -subscriptionId "<Subscription ID>" `
-resourceGroupName "<Resource Group Name>" `
-StorageAccountNAme "<Storage Account Name (3-15 charaters all lowercase)>" `
-automationAccountName "<Automation Account Name>" `
-keyVaultName "<Key Vault Name>" `
@davoodharun
davoodharun / Create-AzureServicePrincipalForClient
Last active February 23, 2017 21:32
Create Azure Service Principal for starting and monitoring Azure Automation Job
Param (
[Parameter(Mandatory=$true)]
[String] $SubscriptionId,
[Parameter(Mandatory=$true)]
[String] $ApplicationDisplayName,
[string]$backupKeyVaultName
)
@davoodharun
davoodharun / 0_reuse_code.js
Created March 29, 2017 15:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am davoodharun on github.
  • I am davoodharun (https://keybase.io/davoodharun) on keybase.
  • I have a public key ASA_XIOJQ5wlaCxoLbtDNLnC6NxFC_xAZvMAVWfs3UwDtQo

To claim this, I am signing this object:

@davoodharun
davoodharun / runbookAzureAutomation.ps1
Last active July 29, 2018 10:08
Sample PowerShell Runbook for Azure deployment
#The following is an Azure Automation PowerShell runbook.
#Uses a preconfigured AutomationConnection object (AzureRunAsConnection) for authentication
#This object must be in place in your tenant with the appropriate role(s), and added as a connection asset in the
#Azure Automation account being used.
Param(
[string]$environmentName = "AzureUSGovernment",
[Parameter(Mandatory=$true)]
[string]$subscriptionId,
[string]$location = "USGov Virginia",