Skip to content

Instantly share code, notes, and snippets.

@Velrok
Velrok / bq-vd
Created June 24, 2022 21:29
NeoVim BigQuery integration. Sends current file content as query to BQ and opens result in terminal split with VisiData.
#!/usr/bin/env bash
set -e
query_file="$1"
# use json instead of csv, because I had an error where BQ complained it could not render a field as csv table
bq query --format json --headless -sync -quiet < "$query_file" 2>/dev/null \
| vd --filetype json

The power of command line tools

Topics

  1. modern fast replacements for established use cases
  2. new more powerful tools
  3. interactive command line tools aka text UI or TUI

@Velrok
Velrok / jira-tickets-active.sh
Last active June 17, 2022 11:39
List and preview active tickets. Fuzzy search and preview via fzf.
#!/usr/bin/env bash
set -e
# brew install ankitpokhrel/jira-cli/jira-cli fzf
jira issue list \
--columns KEY,STATUS,SUMMARY,RESOLUTION,ASSIGNEE \
--resolution x \
--type ~Epic \
───────┬────────────────────────────────────────────────────────────────────────
│ File: /Users/waldemar/.config/nvim/init.vim
───────┼────────────────────────────────────────────────────────────────────────
1 │ call plug#begin()
2 │ " Global:
3 │ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
4 │ " Plug 'kien/ctrlp.vim'
5 │ Plug 'tpope/vim-sensible'
6 │ Plug 'rking/ag.vim'
7 │ Plug 'scrooloose/nerdtree'
@Velrok
Velrok / infer-spec.clj
Created May 21, 2019 13:28
A command line tool to infer a clojure spec from a line seq of data.
#!/usr/bin/env inlein
'{:dependencies [[org.clojure/clojure "1.10.0"]
[spec-provider "0.4.14"]
[org.clojure/tools.cli "0.4.2"]
[cheshire "5.8.1"]]}
(require '[cheshire.core :as json])
(require '[clojure.edn :as edn])
(require '[spec-provider.provider :as sp])
(require '[clojure.string :as string])
@Velrok
Velrok / edn-to-json.clj
Last active April 10, 2019 11:26
cli to convert edn to json
#!/usr/bin/env inlein
'{:dependencies [[org.clojure/clojure "1.10.0"]
[cheshire "5.8.1"]]}
(require '[cheshire.core :as json])
(require '[clojure.edn :as edn])
(defn read-edn
[s]
(try
{
"ignition": {
"version": "2.1.0",
"config": {}
},
"storage": {},
"systemd": {},
"networkd": {},
"passwd": {
"users": [
@Velrok
Velrok / id_rsa.pub
Created November 27, 2017 23:08
pubic key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDcJIYfSR6r85ZbogEhuPFnptCCHE9kVtUL7ekX+vMlXj5lQ/H1NSLm4Fls14z+yiimQAEbF4Vl7bM+YwX1azwoCihVseeRgwIZi0Ukb0et0Llh3/tOX5aM47gNdYyAWXDiz2Tsj/Sz0prm6m4N5AymHQXKfWqPdqJszZ/0iZXu1ZQeteGR3wnHObIh6721PdmgLz0/YPkMDx7/gfYLrqV/DvGeCQimg+V3d//NPLdNXlFUOrxiiTne8zC61R/LNavE0i+DdQu0qFgSFUiVnimlswgzkZy6gWMsZpdWbnkEQmsXhMq73/TakQVxDNBDuNu/P+Apwhi0IGVjwK2h52vs9gAQCxnekP+7puVZrQqsw/i8619eRi6ELNpYYyCIkFEyOFtjTtfDe0nsU0FiFYLQGksd2tcRdVGwV42H/JwJH5wF9YGjnkBxD21PqUUeinKyuujb7AH1DtwIAtv3KKf5MtjxCWRAFKZd5EB8sj8iuuzNFsQJokqIyLNp4JAKiJbtaJJ5Hj23YOtc275dA3Prczn1GGP9lXE6uqaf38LeIYdUg8mAEmwkeoCmcbYE5aqnohax2Z3tYIOABdlE5/qoNyF4ziQ/nEJUrpRBJ2ens0ABb/lJXg7M5Xo7n++5EgLy1Bo23e/nREsQIZr/ookpVYHYvsSJsw1BKnk+ixZeAQ== [email protected]

Keybase proof

I hereby claim:

  • I am velrok on github.
  • I am velrok (https://keybase.io/velrok) on keybase.
  • I have a public key ASCtj3g7F-0bL8rlPOJ42abTtSh8SJMr18WIMVLUz6U8QAo

To claim this, I am signing this object:

@Velrok
Velrok / follow_json_logs
Created March 31, 2017 11:14
Piple the logs of an app into follow_json_logs. If the message is json it will pretty print it. Optionally parse a jq query as a first argument.
function follow_json_log {
if [ -n "$1" ]
then
jq -R "fromjson? | select (type == \"object\") | $1"
else
jq -R 'fromjson? | select (type == "object")'
fi
}