Skip to content

Instantly share code, notes, and snippets.

View stevelizcano's full-sized avatar
🎯
Focusing

Stephen Lizcano stevelizcano

🎯
Focusing
View GitHub Profile
@stevelizcano
stevelizcano / pgtype.go
Created November 11, 2023 15:52
A PG TypeID type that can be used with SQLC and the package typeID. It allows you to specify this type and parse the tuple returned from postgres into a typeid.
type PGTypeID string
// ConvertToTypeID converts the PGTypeID to the typeid.TypeID.
func (p PGTypeID) ConvertToTypeID() (typeid.TypeID, error) {
str := string(p)
if !strings.HasPrefix(str, "(") || !strings.HasSuffix(str, ")") {
return typeid.Nil, errors.New("invalid type id format")
}
// Remove the surrounding parentheses and replace the comma with an underscore
@stevelizcano
stevelizcano / convert.sh
Last active June 8, 2021 12:22
Convert AWS Secrets Manager Secret to env file. Apply to kubernetes secret
# AWS SECRETS MANAGER command line -- pull secret from cli and apply to kubernetes secret
# This takes a secret, which probably would have more than one key-value pair, and converts it to an env file.
# This is useful for CI/CD pipelines that use Kubernetes
aws secretsmanager get-secret-value --secret-id $SECRET_ID --profile $AWS_PROFILE --output json | jq '.SecretString' | jq fromjson | jq -r "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]" >> .env
# Example to take output and apply or update a kubernetes secret
kubectl create secret generic $SECRET_NAME --from-env-file=.env --dry-run=client -o yaml | kubectl apply -f -
@stevelizcano
stevelizcano / blog_post_1.md
Created November 8, 2019 14:16
Blog post for extracting base types AWS Amplify & TypeScript

Test H1

Test H2

var s = "JavaScript syntax highlighting";
alert(s);
@stevelizcano
stevelizcano / index.html
Created February 9, 2019 22:46
SMART on FHIR Demo - Body Mass Index App Final
<div class="card">
<div class="card-body">
<h5>My second SMART on FHIR page!</h5>
<h1 id='pt_name'>...</h1>
<h3>BMI: <span id="bmi">[calculating...]</span> kg/m<sup>2</sup></h3>
<table class="table">
<tr>
<th>
<h2>Weight List</h2>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.