Since Docker 1.9, there's an easy way to find unused volumes and delete them.
To list unused volumes, use this command
$ docker volume ls -qf dangling=true
To delete them, use
$ docker volume rm $(docker volume ls -qf dangling=true)
Credit: I copied the whole thing from this SO answer
Thursday, May 12, 2016
Tuesday, May 10, 2016
[Fixed] WARN Not all child routes satisfy compojure.api.routing/Routing. {:path nil, :method nil}, invalid child routes:
I had this error in my client app that uses compojure-api. The cause of this problem is that I put the static assets routing configuration in the wrong place. We put (route/resources "/") inside defapi which is a place for api routing configurations. So to fix this, we create a defroutes for static assets routing config and merge this defroutes with defapi before giving it to webserver as a ring handler. At the end, the code look something like this.
(ns my.namespace
(:require [compojure.api.sweet :refer [defapi]]
[compojure.core :refer [defroutes routes]]
[compojure.route :as route]))
(defapi app
...)
(defroutes site
...
(route/resources "/"))
(defn handler []
(route site app))
(ns my.namespace
(:require [compojure.api.sweet :refer [defapi]]
[compojure.core :refer [defroutes routes]]
[compojure.route :as route]))
(defapi app
...)
(defroutes site
...
(route/resources "/"))
(defn handler []
(route site app))
Tuesday, April 26, 2016
Set daemon config for Docker for Mac
Just follow what describe in this link How to run a insecure-registry
Capture the screen in case the link is gone in the future
Capture the screen in case the link is gone in the future
Unix, use output of the previous command
Not a direct solution but it suits my need.
Use !! to expand the previous command and evaluate it with $() or ``For example;
$ which pinata
/usr/local/bin/pinata
$ ls -lh `!!`
...Credit: http://stackoverflow.com/a/5955674/1032449
Thursday, February 25, 2016
Interesting use case example for `are` macro in Clojure test
I found an interesting use case for are in Clojure test.
You might have ever written a test for your data conversion logic. E.g.
Updated: I have retested, are does report problem for an individual case as well.
You might have ever written a test for your data conversion logic. E.g.
- Converting data pulled from third-party web service into your internal schema.
- Converting data fetched from your database to more mobile friendly schema before sending out.
This is an example snippet of test for such a scenario.
convert-test1 shows the style I had been writing until recently. convert-test2 shows how using are making the test better.
convert-test1 shows the style I had been writing until recently. convert-test2 shows how using are making the test better.
Pros:
- No more duplication of field values between input and output.
- No more duplication between output schema and code under test schema.
- It can be use as a document showing clearly how each individual field is mapped.
Cons:
An error message in convert-test1 is better. It shows clearly which field is wrong while convert-test2 throw out the whole problematic result data.
Updated: I have retested, are does report problem for an individual case as well.
Wednesday, February 10, 2016
[ClojureScript] Run all tests in multiple namespaces in REPL
From ClojureScript wiki, it says
If you have many test namespaces it's idiomatic to create a test runner namespace which imports all of your test namespaces and then invokes run-testsI personally couldn't get it to work. Though I have managed to make run-all-tests works. This is an example
(ns myns.test.runner (:require [cljs.test :refer-macros [run-all-tests]] [myns.test.ns1] [myns.test.ns2])) (run-all-tests #"myns.test.*")
[DataScript][Solved] Error: Expected number or lookup ref for entity id, got
When you are trying to use Map specification of Datomic's pull api and you got this error
Error: Expected number or lookup ref for entity id, got ....This happens because you didn't specify schema for that data attribute. Schema is optional on DataScript but it is required in this case. Add this line to your database, the issue should be fixed
{:your-attribute1 {:db/valueType :db.type/ref}
:your-attribute2 {:db/valueType :db.type/ref}}
Subscribe to:
Posts (Atom)
Collectd PostgreSQL Plugin
I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...
-
sudo su postgres supply your Mac password modify /Library/PostgreSQL/9.x/data/pg_hba.conf from local all all md5 to local all all ...
-
This error message from chef is not very useful FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit ...
-
Formatting Run this command in shell sudo cpan JSON::XS Put this line to ~/.vimrc map <leader> jt <Esc> : %! json_xs -f json ...
