Install packages
brew install openjdk rlwrap clojure leiningen borkdude/brew/babashka babashka/brew/neil visual-studio-codeInstall tools
| (╯°□°)╯︵ ┻━┻ |
| (ns myapp.shutdown-hook | |
| (:gen-class)) | |
| (defn add-shutdown-hook! | |
| "Adds a shutdown hook that executes the given function when the JVM is shutting down." | |
| [f] | |
| (.addShutdownHook | |
| (Runtime/getRuntime) | |
| (new Thread ^Runnable f))) |
A hello world with Clojurescript+shadow-cljs+reagent.
| # Until boto3 adds sync capability, we are stuck with subprocess or module hacks like this. | |
| # original author: https://github.com/boto/boto3/issues/358#issuecomment-372086466 | |
| import os | |
| from awscli.clidriver import create_clidriver | |
| def aws_cli(*cmd): | |
| old_env = dict(os.environ) | |
| try: | |
| # Environment | |
| env = os.environ.copy() |
| DO $$ | |
| DECLARE | |
| i TEXT; | |
| BEGIN | |
| FOR i IN ( | |
| SELECT 'SELECT SETVAL(' | |
| || quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) | |
| || ', COALESCE(MAX(' ||quote_ident(C.attname)|| '), 1) ) FROM ' | |
| || quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';' | |
| FROM pg_class AS S, |
| -- List all sequences and their current values, excluding system schemas | |
| SELECT | |
| n.nspname as schema, | |
| s.relname as sequence_name, | |
| t.relname as table_name, | |
| a.attname as column_name, | |
| pg_sequence_last_value(s.oid) as last_value | |
| FROM pg_class s | |
| JOIN pg_namespace n ON n.oid = s.relnamespace | |
| JOIN pg_depend d ON d.objid = s.oid |