Skip to content

Instantly share code, notes, and snippets.

@benkehoe
benkehoe / aws-profile-for-bashrc.sh
Last active April 2, 2024 10:41
AWS_PROFILE env var management
# MIT No Attribution
#
# Copyright 2022 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
@rafaeldff
rafaeldff / README.md
Created December 30, 2019 16:57
Clojure exceptions as data format

Clojure exceptions are really just Java exceptions under the hood. However, at times clojure shows them formatted as a map data structure. For instance, that's what you get if you inspect them in the REBL. This is because clojure implements the Datafy protocol for Throwable objects, delegating to clojure.core/Throwable->map.

This gist is a reminder of how to interpret that data assuming familiary with Java printed stack traces.

@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly
@shortjared
shortjared / list.txt
Last active July 19, 2024 21:20
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@matklad
matklad / idea.nix
Last active February 10, 2023 17:58
Using JetBrains JDK with Intellij IDEA on nixos
# Put this file into `~/.config/nixpkgs/overlays/idea.nix`.
# Then, install IDEA with `nix-env -iA nixos.idea-community`.
self: super:
{
jbsdk = super.callPackage ~/config/nix/jbsdk.nix {}; # you might need to override this path.
idea-community = let
version = "2017.2.3";
@cgrand
cgrand / kein.sh
Last active May 31, 2017 14:11
Launch a plain clojure repl according to project.clj without leiningen (most of the time)
#!/bin/bash
# launch a clojure plain repl but with options and classpath matching project.clj
# Except when project.clj changes (and on first launch), lein is not called.
CODE='
(let [p (leiningen.core.project/read)
args (@(var leiningen.core.eval/get-jvm-args) p)
cp (with-out-str (leiningen.classpath/classpath p))]
(print "ARGS=\"")
(apply print args)
@kennyjwilli
kennyjwilli / defspec-test.clj
Created November 5, 2016 01:37
clojure.spec.test integration with clojure.test
(defmacro defspec-test
([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil))
([name sym-or-syms opts]
(when t/*load-tests*
`(def ~(vary-meta name assoc :test `(fn []
(let [check-results# (clojure.spec.test/check ~sym-or-syms ~opts)
checks-passed?# (every? nil? (map :failure check-results#))]
(if checks-passed?#
(t/do-report {:type :pass
:message (str "Generative tests pass for "
(ns virgil
(:require
[clojure.java.io :as io]
[clojure.string :as str]
[filevents.core :as fe])
(:import
[javax.tools
DiagnosticCollector
ForwardingJavaFileManager
JavaCompiler
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@kachayev
kachayev / css-parser.md
Last active November 12, 2022 04:20
Parsing CSS file with monadic parser in Clojure