Skip to content

Instantly share code, notes, and snippets.

View percygrunwald's full-sized avatar

Percy Grunwald percygrunwald

View GitHub Profile
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active April 10, 2024 16:40
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active January 20, 2024 12:57
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@timruffles
timruffles / ports.ex
Last active February 8, 2023 14:53
erlang ports bewlider me
defmodule LearningPorts do
def main do
parent = self()
# if we need to control STDIN, the fun begins:
# unfortunately we can't close the port's stdin without closing the port.
# so it'll block waiting forever for an EOF that'll never appear.
#
# so we use a wrapper program that allows us to specify a sentinel line