Skip to content

Instantly share code, notes, and snippets.

Naaman Campbell naamancampbell

Block or report user

Report or block naamancampbell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@naamancampbell
naamancampbell / copy_lambda_env_vars.py
Last active May 30, 2019
Copy AWS Lambda environment variables from source Lambda function to destination Lambda function
View copy_lambda_env_vars.py
import argparse
import boto3
"""
Usage: copy_lambda_env_vars.py [-h] [--src-profile-name SRC_PROFILE]
[--dst-profile-name DST_PROFILE]
src_function dst_function
Utility to copy environment variables from source Lambda function to
destination Lambda function.
@naamancampbell
naamancampbell / function.json
Created Jan 2, 2018
Strava API Subscription Webhook on Azure Functions
View function.json
{
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"name": "req",
"authLevel": "anonymous",
"methods": [
"get",
"post"
@naamancampbell
naamancampbell / .env_lambda.ps1
Last active Jan 2, 2018
Reads PowerShell environment variables file to upload to AWS Lambda
View .env_lambda.ps1
<#
.SYNOPSIS
Reads PowerShell environment variables file to upload to AWS Lambda
.DESCRIPTION
The .env_lambda script is made of the following steps:
1. Skips the first three lines of the .env file
2. Retrieves the contents of each line after the first ":"
3. Joins all variables into a comma-separated string
4. Uploads variables up to AWS Lambda
@naamancampbell
naamancampbell / dashboard.html
Last active Oct 19, 2019
Display Multiple Strava Activity Maps in Flask Template
View dashboard.html
{% for activity in activities %}
<div class="post">
{% if activity.strava_data['map']['polyline'] is not none %}
<div id="map_{{ activity.id }}" class="img-fluid" style="height: 300px;"></div>
{% endif %}
{# other activity data #}
</div>
{% endfor %}
@naamancampbell
naamancampbell / Disable-UAC.ps1
Created Oct 21, 2017
Disables UAC without privilege escalation. NB. Must run from another host (mgmt).
View Disable-UAC.ps1
##########
## 1. Save file on mgmt host.
## - change 'COMPUTERNAME' to target hostname
##########
Configuration Disable-UAC {
Import-DscResource -ModuleName PsDesiredStateConfiguration
Import-DscResource -ModuleName xSystemSecurity -Name xUac
@naamancampbell
naamancampbell / CloudFormation-PowerShell-Creds.ps1
Last active May 10, 2019 — forked from davefunkel/Script-Template-WithCreds.ps1
Generates and distributes encrypted passwords for use with PowerShell scripts used in CloudFormation templates.
View CloudFormation-PowerShell-Creds.ps1
<#
.SYNOPSIS
Generates and distributes encrypted passwords for use with PowerShell scripts used in CloudFormation templates.
.DESCRIPTION
The CloudFormation-PowerShell-Creds script is designed to be run prior to running a CloudFormation stack
then called again from within the CloudFormation template. The purpose is to avoid the use of cleartext
passwords in CloudFormation templates/PowerShell scripts.
There are three main components of this script:
View ADFS-certutil-CSR.ps1
## generate Certificate Signing Request (CSR) with certutil
$FedServiceName = "sts.clancampbell.id.au"
$RequestPolicy = @"
[Version]
Signature="`$Windows NT$"
[NewRequest]
Subject = "CN=$FedServiceName,OU=ICT,O=ClanCampbell,L=Brisbane,S=Queensland,C=AU"
Exportable = FALSE ; TRUE = Private key is exportable
KeyLength = 2048 ; Valid key sizes: 1024, 2048, 4096, 8192, 16384
KeySpec = 1 ; Key Exchange – Required for encryption
@naamancampbell
naamancampbell / acmecert.ps1
Last active Oct 17, 2017
Automatically provisions new Lets Encrypt SSL certificate (using AWS Route 53 DNS verification) and adds to Windows Local Machine certificate store. Route 53 IAM Role required.
View acmecert.ps1
###
# References:
# - https://github.com/RobBiddle/ACMESharpRoute53Automation
# - https://github.com/ebekker/ACMESharp/wiki/Quick-Start
# - https://pkisharp.github.io/ACMESharp-docs/Quick-Start
# - https://www.frankysweb.de/exchange-2016-lets-encrypt-zertifikat-erneuern/
###
$BaseDomain = "clancampbell.id.au"
$FedServiceName = "sts.$BaseDomain"
@naamancampbell
naamancampbell / powershell-commands.ps1
Last active May 10, 2019
aws-cloudformation-awsmad - Automating the setup of an Office 365-enabled AWS Directory Services Microsoft Active Directory - as per https://aws.amazon.com/blogs/security/how-to-enable-your-users-to-access-office-365-with-aws-microsoft-active-directory-credentials/
View powershell-commands.ps1
# ADMgmt
## install chocolatey
Set-ExecutionPolicy Bypass; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
## install firefox
choco install -y firefox
## install AD Tools
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-Tools
## create testing accounts
New-ADOrganizationalUnit -Name "Groups" -Path "OU=CLANCAMPBELL,DC=clancampbell,DC=id,DC=au"
You can’t perform that action at this time.