Skip to content

Instantly share code, notes, and snippets.

View tgallant's full-sized avatar
🌁
☕️☕️☕️

Tim Gallant tgallant

🌁
☕️☕️☕️
  • San Francisco, CA
View GitHub Profile
@Orbots
Orbots / evaluator.cljs
Last active December 25, 2015 00:29
bare-bones metacircular evaluator in clojurescript
;; Develop your clojurescript program here
(ns metacirc.evaluator (:require [cljs.reader :as reader]))
;; TODO:
;; globals: "let", "do"
;; javascript interop
;; var args or at least get more than 4 for list
;; {} [] #{} '()
@rnewson
rnewson / haproxy.cfg
Last active November 18, 2021 22:12
haproxy.cfg stanzas to enable Perfect Forward Secrecy and HTTP Strict Transport Security. Requires OpenSSL 1.0.1g or so.
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:!MD5:!aNULL:!DH:!RC4
# Distinguish between secure and insecure requests
acl secure dst_port eq 443
# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure
# Add the HSTS header with a 1 year max-age
@plamb
plamb / gce_auth.ex
Last active November 7, 2024 04:26
Authenticate with Google Cloud using service account json key and Elixir
# https://developers.google.com/identity/protocols/OAuth2ServiceAccount
key_json = File.read!("some-service-account-key-file.json")
key_map = JOSE.decode(key_json)
jwk = JOSE.JWK.from_pem(key_map["private_key"])
jws = %{"alg" => "RS256"}
header = %{