Skip to content

Instantly share code, notes, and snippets.

Michael Ludvig mludvig

Block or report user

Report or block mludvig

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
@mludvig
mludvig / aurora-standalone.yml
Created Sep 3, 2019
Standalone AWS Aurora template
View aurora-standalone.yml
AWSTemplateFormatVersion: '2010-09-09'
Description: PostgreSQL Aurora Cluster
Metadata:
Author: Michael Ludvig <michael.ludvig@enterpriseit.co.nz>
Parameters:
DbName:
Type: String
@mludvig
mludvig / cfn-service-role-and-policy.yml
Last active Aug 10, 2019
CloudFormation Service Role and Policy
View cfn-service-role-and-policy.yml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation Service Role and Policy
Metadata:
Author: Michael Ludvig
Url: https://aws.nz/best-practice/cloudformation-service-roles/
Parameters:
RoleName:
@mludvig
mludvig / ssml_simple.py
Created Mar 14, 2019
Basic SSML-enhanced text synthesis
View ssml_simple.py
#!/usr/bin/env python3
# ssml_simple.py - Basic SSML-enhanced text output
# Author Michael Ludvig
# Import play_audio_stream() from audio_helper.py
from audio_helper import play_audio_stream
# Boto3 is the AWS SDK for Python
import boto3
@mludvig
mludvig / describe_voices.py
Created Mar 13, 2019
Describe and play all available AWS Polly voices
View describe_voices.py
#!/usr/bin/env python3
# describe_voices.py - describe and play all AWS Polly voices
# Author Michael Ludvig
import boto3
from audio_helper import play_audio_stream
polly = boto3.client('polly')
View ssml_simple-part.py
# SSML-enhanced audio
ssml_text = '''
<speak>
Let me tell you a secret.
<break time="1s" />
<amazon:effect name="whispered">Amazon Alexa is my sister!</amazon:effect>
</speak>
'''
response = polly.synthesize_speech(OutputFormat='ogg_vorbis', VoiceId='Emma',
@mludvig
mludvig / hello_polly.py
Created Mar 13, 2019
Simple AWS Polly demo
View hello_polly.py
#!/usr/bin/env python3
# hello_polly.py - Simple AWS Polly demo
# Author Michael Ludvig
# Import play_audio_stream() from audio_helper.py
from audio_helper import play_audio_stream
# Boto3 is the AWS SDK for Python
import boto3
@mludvig
mludvig / audio_test.py
Created Mar 13, 2019
Simple pygame audio test
View audio_test.py
#!/usr/bin/env python3
# audio_test.py - simple pygame audio test
# Author Michael Ludvig
import pygame
# PyGame initialisation
pygame.init()
pygame.mixer.init()
@mludvig
mludvig / audio_helper.py
Last active Mar 13, 2019
Sample code for using AWS Polly in Python
View audio_helper.py
#!/usr/bin/env python3
# audio_helper.py - simple PyGame audio player
# Author Michael Ludvig
import io
import pygame
# PyGame initialisation - upon module loading
pygame.init()
View pythonstart.py
# startup script for python to enable saving of interpreter history and
# enabling name completion
# import needed modules
import atexit
import os
import readline
import rlcompleter
# where is history saved
View profile-local.sh
#!/bin/bash
# Save as /etc/profile.d/local.sh or as your local ~/.bash_profile
# By Michael Ludvig <mludvig@logix.net.nz>
umask 022
if [ $(id -u) = "0" ]; then
# Prompt is RED for root
_PS1COLOUR=31
else
You can’t perform that action at this time.