Skip to content

Instantly share code, notes, and snippets.

@rintcius
rintcius / docker-cleanup-resources.md
Created February 15, 2018 15:40 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@rintcius
rintcius / plan.txt
Created December 19, 2017 12:55
(v27.6.6) πŸ’ͺ $ select b[*] + c[*] from intArrays
(v27.6.6) πŸ’ͺ $ select b[*] + c[*] from intArrays
SQL AST:
Select
β”œβ”€ Proj
β”‚ ╰─ Binop(+)
β”‚ β”œβ”€ Unop(flatten_array)
β”‚ β”‚ ╰─ Ident(b)
β”‚ ╰─ Unop(flatten_array)
β”‚ ╰─ Ident(c)
╰─ TableRelation(intArrays)
@rintcius
rintcius / plan.txt
Created December 18, 2017 08:45
(v27.6.2) πŸ’ͺ $ select * from user_comments where (comments[*].id LIKE "%Dr%" OR comments[*].replyTo[*] LIKE "%Dr%")
(v27.6.2) πŸ’ͺ $ select * from user_comments where (comments[*].id LIKE "%Dr%" OR comments[*].replyTo[*] LIKE "%Dr%")
SQL AST:
Select
β”œβ”€ Proj
β”‚ ╰─ Splice
β”œβ”€ TableRelation(user_comments)
╰─ Binop(or)
β”œβ”€ InvokeFunction(like)
β”‚ β”œβ”€ Binop({})
β”‚ β”‚ β”œβ”€ Unop(flatten_array)
@rintcius
rintcius / query.txt
Created December 12, 2017 17:50
group by simple expression (v20.15.4)
πŸ’ͺ $ select city, sum(pop) from extraSmallZips group by lower(city)
MongoDB:
db.extraSmallZips.aggregate(
[
{
"$group": {
"city": { "$push": "$city" },
"1": {
"$sum": {
"$cond": [
@rintcius
rintcius / plan.txt
Created December 12, 2017 16:15
select name from newTests where count(backends{_}) = 12 order by name limit 5
(v27.4.2) πŸ’ͺ $ select name from newTests where count(backends{_}) = 12 order by name limit 5
SQL AST:
Binop(limit)
β”œβ”€ Select
β”‚ β”œβ”€ Proj
β”‚ β”‚ ╰─ Ident(name)
β”‚ β”œβ”€ TableRelation(newTests)
β”‚ β”œβ”€ Binop(=)
β”‚ β”‚ β”œβ”€ InvokeFunction(count)
β”‚ β”‚ β”‚ ╰─ Unop(shift_map)
@rintcius
rintcius / plan.txt
Created December 8, 2017 13:32
plan simple inner equi-join with pre-filtering ($lookup) (v20.15.4)
πŸ’ͺ $ select zips.city, smallZips.state from zips join smallZips on zips.`_id` = smallZips.`_id` where smallZips.pop >= 10000
SQL AST:
Select
β”œβ”€ Proj
β”‚ ╰─ Binop({})
β”‚ β”œβ”€ Ident(zips)
β”‚ ╰─ LiteralExpr("city")
β”œβ”€ Proj
β”‚ ╰─ Binop({})
β”‚ β”œβ”€ Ident(smallZips)
@rintcius
rintcius / plan.txt
Created December 8, 2017 13:25
plan simple inner equi-join with expression ($lookup) (v20.15.4)
πŸ’ͺ $ select zips.city, smallZips.state from zips join smallZips on lower(zips.`_id`) = smallZips.`_id`
SQL AST:
Select
β”œβ”€ Proj
β”‚ ╰─ Binop({})
β”‚ β”œβ”€ Ident(zips)
β”‚ ╰─ LiteralExpr("city")
β”œβ”€ Proj
β”‚ ╰─ Binop({})
β”‚ β”œβ”€ Ident(smallZips)
@rintcius
rintcius / qscript.txt
Created November 14, 2017 15:40
3 way join
EquiJoin
β”œβ”€ Unreferenced
β”œβ”€ Filter
β”‚ β”œβ”€ EquiJoin
β”‚ β”‚ β”œβ”€ Unreferenced
β”‚ β”‚ β”œβ”€ Filter
β”‚ β”‚ β”‚ β”œβ”€ ShiftedRead(/test/extraSmallZips, IncludeId)
β”‚ β”‚ β”‚ ╰─ Guard
β”‚ β”‚ β”‚ β”œβ”€ ProjectIndex
β”‚ β”‚ β”‚ β”‚ β”œβ”€ β—‹
@rintcius
rintcius / hakyll.hs
Created October 6, 2017 18:15 — forked from simonmichael/hakyll.hs
A generic hakyll script
#!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
{- |
A simple hakyll website builder suitable for software project sites,
intended to be used as-is without recompilation. Functionality:
- copies these static files to _site/ :
*.{html,htm}
*.{gif,jpg,jpeg,png}
@rintcius
rintcius / reflect.py
Created January 25, 2017 14:00 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):