Skip to content

Instantly share code, notes, and snippets.

View Satak's full-sized avatar

Sami Koskivaara Satak

View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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 / import_script.ps1
Last active August 27, 2021 12:57
Create DevOps projects and AAD groups
$devOpsProjects = (az devops project list | ConvertFrom-Json).value
foreach ($i in $devOpsProjects) {
Write-Output "importing $($i.name)"
$command = @"
terraform import 'azuredevops_project.project[\"$($i.name)\"]' "$($i.id)"
"@
Invoke-Expression $command
}
@Satak
Satak / terraform-test.ps1
Created December 31, 2021 07:07
Terraform unit test with Pester/Powershell
BeforeDiscovery {
$testCases = Get-ChildItem -Path (Join-Path $PSScriptRoot examples) -Directory
}
describe 'terraform-module-storage - <_.Name>' -ForEach $testCases {
BeforeAll -ErrorAction Stop {
$exampleName = $_
Push-Location $exampleName
Write-Host "Test case: $($ExampleName.Name)" -Foreground Magenta