View fizzbuzz.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# FizzBuzz -- created by M. Massenzio, 2022-03-26 | |
import sys | |
n = sys.argv[1] | |
for i in range(3, int(n) + 1): | |
out = "" | |
if i % 3 == 0: |
View babies.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"github.com/go-redis/redis/v8" | |
"os" | |
"time" | |
) |
View contains.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// Tempting, but this will NOT compile | |
// | |
//func (arr []interface{}) Has(x interface{}) bool { | |
// for _, val := range arr { | |
// if val == x { | |
// return true |
View UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("/api/users") | |
public class UserController { | |
@Autowired | |
private UserRepository userRepository; | |
@Autowired | |
private UserService userService; |
View ErrorStateMachine.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "A state machine to experiment with errors", | |
"StartAt": "Error Handler", | |
"States": { | |
"Error Handler": { | |
"Type": "Task", | |
"Resource": "arn:aws:states:::lambda:invoke", | |
"OutputPath": "$.Payload", | |
"Parameters": { | |
"Payload.$": "$", |
View delete-iam-role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
set -eu | |
ROLE=${1:-} | |
if [[ -z ${ROLE} ]]; then | |
printf "Usage: delete-iam-role ROLE\n\nERROR: ROLE must be specified\n" | |
exit 1 | |
fi |
View font.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to load fonts via Python PIL. | |
# See Stack OF question: https://stackoverflow.com/questions/24085996/how-i-can-load-a-font-file-with-pil-imagefont-truetype-without-specifying-the-ab/41887497#41887497 | |
from PIL import Image, ImageDraw, ImageFont | |
# sample text and font | |
unicode_text = u"Arial Font, size 28px" | |
font = ImageFont.truetype("/Library/Fonts/Arial.ttf", 28, encoding="unic") | |
# get the line size |
View minikube-install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Installs minikube on MacOS | |
# See: https://github.com/kubernetes/minikube/releases | |
declare -r VERSION=${1:-} | |
if [[ -z ${VERSION} ]]; then | |
echo "Please specify a version" | |
exit 1 |
View install_jdk_10.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Installs the OpenJDK 10 from java.net. | |
VERSION=10.0.2 | |
DOWNLOAD_URL="download.java.net/java/GA/jdk10" | |
JDK="openjdk-${VERSION}_osx-x64_bin.tar.gz" | |
INSTALL_DIR="/Library/Java/JavaVirtualMachines" | |
wget https://${DOWNLOAD_URL}/${VERSION}/19aef61b38124481863b1413dce1855f/13/${JDK} -O /tmp/${JDK} |
NewerOlder