Skip to content

Instantly share code, notes, and snippets.

View Satak's full-sized avatar

Sami Koskivaara Satak

View GitHub Profile
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"containerName": {
"type": "string"
},
"dnsNameLabel": {
"type": "string"
},
Get-Disk | Where-Object {$_.PartitionStyle -eq 'RAW'} | Initialize-Disk -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume
param(
[string]$version,
$AllowRemoteExecution = $True
)
# install AV
$path = 'C:\av'
$fileName = 'output.txt'
$fullFilePath = (Join-Path -Path $path -ChildPath $fileName)
New-Item -ItemType Directory -Path $path
New-Item -ItemType File -Path $fullFilePath
@Satak
Satak / cf-template.yaml
Created February 15, 2019 13:20
AWS CloudFormation Template
Resources:
MyInstance:
Type: 'AWS::EC2::Instance'
Properties:
AvailabilityZone: eu-west-1a
ImageId:
Ref: ImageId
KeyName: !Ref KeyName
InstanceType:
Ref: InstanceType
package main
import (
"encoding/base64"
"fmt"
"math/rand"
"time"
"golang.org/x/crypto/bcrypt"
)
@Satak
Satak / env.py
Last active March 28, 2018 06:56
'''
This script parses environment variables and gets set of three variables at the time.
It then calls function with those arguments (database, username, password) based on pattern:
DB_<UNIQUENAME>_DATABASE
DB_<UNIQUENAME>_USERNAME
DB_<UNIQUENAME>_PASSWORD
'''
import re
import crypt
def crypt_test(password, salt, checksum='my43charchecksum'):
'''Test only the logic without crypt library'''
correct = 'iCeCream9999'
if password == correct:
return 'prefix {} suffix'.format(checksum)
return 'prefix something else suffix'
'''Dynamic templates'''
# -*- coding: utf-8 -*-
import os
import locale
from string import Template
class Car:
'''Class Car'''