Skip to content

Instantly share code, notes, and snippets.

View Satak's full-sized avatar

Sami Koskivaara Satak

View GitHub Profile
@Satak
Satak / main.tf
Last active May 25, 2021 05:23
Terraform snippets
variable "my_list" {
default = [
{
id = 1
name = "name1"
},
{
id = 2
name = "my_name"
},
@Satak
Satak / main.py
Created May 11, 2021 15:31
Get pdf copy of website
from selenium import webdriver
from time import sleep
import json
# download: https://chromedriver.storage.googleapis.com/90.0.4430.24/chromedriver_win32.zip
# extract the content to C:\Program Files\Chromedriver so you have "C:\Program Files\Chromedriver\chromedriver.exe"
# add C:\Program Files\Chromedriver to system environment variable paths
# pip install selenium
URL = "https://google.com"
@Satak
Satak / locations.json
Created May 10, 2021 06:11
Azure regions/locations/names
[
{
"name": "eastus",
"regionalDisplayName": "(US) East US"
},
{
"name": "eastus2",
"regionalDisplayName": "(US) East US 2"
},
{
@Satak
Satak / azure_account.ps1
Created April 15, 2021 08:44
Azure account cmdlets
function New-AzureAccount {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]$ClientId,
[Parameter(Mandatory)]
[string]$ClientSecret,
[Parameter(Mandatory)]
@Satak
Satak / main.tf
Last active April 11, 2023 00:50
Azure Logic App Deployment - Terraform
provider "azurerm" {
features {}
}
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/template_deployment
variable "name" {
default = "test"
}
@Satak
Satak / aws.py
Created March 2, 2021 07:42
AWS Python
import boto3
from pprint import pprint
ec2 = boto3.resource('ec2', 'eu-west-1')
vms = ec2.instances.all()
for vm in vms:
o = {
'id': vm.id,
'state': vm.state['Name'],
@Satak
Satak / removeGitBranch.ps1
Created October 12, 2020 07:43
Clean local git branches
git fetch --prune;git branch | where {$_ -notmatch 'master'} | %{git branch -D $_.trim()}
@Satak
Satak / PS-Zabbix-Host.psm1
Last active September 11, 2020 08:55
Install and register Zabbix agent
function Install-ZabbixAgent {
<#
.SYNOPSIS
Install Zabbix agent for Windows
.DESCRIPTION
Downloads Zabbix agent and installs it for Windows x64 OS
.EXAMPLE
Install-ZabbixAgent
.PARAMETER ZabbixServerIPAddress
Your Zabbix Server IP Address, defaults to allow all connections

About MID server script includes

Developing and debugging MID server script include scripts, especially to CMP/Cloud Provisioning and Governance, can be a little tricky and slow since your native logging is done with the ms.log() function and you can't see the logs from the ServiceNow instance, but instead you need to grab the logs from MID server. Another problem is the script/function execution and context management (login to cloud provider, etc.).

Let's say you need to develop new REST API based functions (day 2 action, like change CPU and memory of a VM) to VMware. How would you develop and test your code?

@Satak
Satak / passwordGenerator.js
Created July 13, 2020 18:34
Random Password Generator
/**
* Generate string from ascii range
* @param {any} ranges - ASCII code
* @param {number} charsCount
* @param {string[]} allCharsTotal
* @return {string}
*/
function generateChars(ranges, charsCount, allCharsTotal) {
var allChars = [];
var i;