Skip to content

Instantly share code, notes, and snippets.

@fernando-mc
fernando-mc / Video.vue
Last active November 9, 2021 18:37
Vue and Mux
<template>
<video
id="my-player" class="video-js vjs-16-9" controls preload="auto" width="100%">
</video>
</template>
<script>
import videojs from '@mux/videojs-kit';
import '@mux/videojs-kit/dist/index.css';
import os
from datetime import datetime
from urllib.request import Request, urlopen
SITE = os.environ['site'] # URL of the site to check, stored in the site environment variable
EXPECTED = os.environ['expected'] # String expected to be on the page, stored in the expected environment variable
def validate(res):
'''Return False to trigger the canary
@fernando-mc
fernando-mc / data.json
Created January 20, 2020 03:44
Data File for DynamoDB
[
{
"artist": "Romero Allen",
"song": "Atomic Dim",
"id": "b4b0da3f-36e3-4569-b196-3ad982f72bbd",
"priceUsdCents": 392,
"publisher": "QUAREX"
},
{
"artist": "Hilda Barnes",
@fernando-mc
fernando-mc / contact_info_updater.py
Created December 9, 2019 21:58
AWS Route 53 Contact Info Updater
import boto3
from pprint import pprint
from bullet import Bullet, Input, styles, VerticalPrompt, Check, YesNo
# List Route 53 domains
r53domains = boto3.client('route53domains')
response = r53domains.list_domains()
domain_list = []
for domain in response["Domains"]:
@fernando-mc
fernando-mc / dynamodb_backup.py
Created August 19, 2019 19:06
DynamoDB Backup and Migration
import time
import boto3
dynamodb = boto3.client('dynamodb')
source_table_name = "customerTable" # Or whatever your source table name is
dest_table_name = "customerTable-dev" # This should be an empty table - the script will delete it first
backup_name = source_table_name + "backupMigration" # Or any other backup name
# Create the backup
@fernando-mc
fernando-mc / create.js
Last active July 7, 2021 22:12
serverless-framework-app
'use strict';
const AWS = require('aws-sdk');
module.exports.create = (event, context, callback) => {
const timestamp = new Date().getTime();
const data = JSON.parse(event.body);
var params = {
TableName: process.env.TABLE_NAME,
Item: {
@fernando-mc
fernando-mc / create.js
Last active July 7, 2021 22:13
SAM Application
'use strict';
const AWS = require('aws-sdk');
module.exports.create = (event, context, callback) => {
const timestamp = new Date().getTime();
const data = JSON.parse(event.body);
var params = {
TableName: "customerTable",
Item: {
@fernando-mc
fernando-mc / README.md
Created October 15, 2018 07:04
Vue.js Game

Open index.html, click the input field and eat the food with the arrow keys.

import csv
import json
# Define the header names so we can specify them when reading the CSV
fieldnames = (
"STATION","NAME","DATE","AWND","PRCP","SNOW","SNWD",
"TAVG","TMAX","TMIN","WT01","WT02","WT03","WT05","WT08"
)
# Open both files so we can interact with them
# ./bin/pyspark
# Assumes headers are not present in files that are processed
# This is meant to run locally. To easily verify it works you can:
# 1. `pip install pyspark`
# 2. startup pyspark: ./bin/pyspark
# 3. copy data similar to the data provided above in the document
# 4. Copy and paste the code into the repl
def cleaner(s):
return str(s).replace('"','').strip(' ')