Jim Cheung

Thursday, November 15, 2018

update fzf default command to ignore .git folder:

 (git ls-tree -r — name-only HEAD ||
 find . -type f -not -path "**/.git/*" -print -o -type l -print |
 sed s/^..//) 2> /dev/null'

installed vim-tmux-navigator, which allows you navigate in and out between vim and tmux panes using same shortcut keys

once installed the plugin, it default maps ctrl j/k/l/h for moving around vim windows

then add these lines to ~/.tmux.conf to enable the same keybindings for tmux:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l

since I use ctrl-l (clear screen) and ctrl-k (kill line) a lot, it bothers me a bit, so I need to re-mapped them:

bind l send-keys 'C-l'
bind k send-keys 'C-k'

one nice feature about duckduckgo is bangs

search results of duckduckgo still not as good as google, but I can use !g [search-term] to switch to google results, other useful bangs:

for languages:

quite interesting to try GNU Stow after reading Managing Dotfiles with GNU Stow

I should be able to simplified the process of setting up a new development environment for me

amazon released Corretto, a production-ready distribution of OpenJDK

I don't like the new release cycle lf java, this provides another option to have a update-to-date patch long term support jdk, very good news

two articles about leveraging airflow to a more usef friendly level:

uber posts two more articles about their big data platform:

Real URLs for AMP Cached Content Using Cloudflare Workers

amp doesn't interests me, Web packaging format and Signed HTTP Exchanges do

I probably will spend more time on golang

about golang 2: A Part of All Good Engineering

infra stuffs:

a nice summary on load balancing strategy: NGINX and the “Power of Two Choices” Load-Balancing Algorithm

more unikernels articles:

Friday, November 16, 2018

TIL you can use csv file as MySQL storage engine

so HTTP-over-QUIC will officially become HTTP/3

people say the problem with http2 over tcp is Head-of-line blocking, I didn't study yet

books I've been reading:

LISA18 videos are up, here's my watch list:

also recommend:

Sunday, November 18, 2018

bought an usb dav: SMSL Sanskrit 10th

on macbook pro, I can see the sample rate is 384kHz, but on my linux laptop always shows 44.1kHz

did a little bit search to make it to 192kHz ...

first know how to find out current sample rate:

$ pacmd list-sinks

then read this article: Enable High Quality Audio on Linux

add these lines to $HOME/.config/pulse/daemon.conf :

default-sample-format = float32le
default-sample-rate = 192000
alternate-sample-rate = 44100
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 2
default-fragment-size-msec = 125
resample-method = soxr-vhq
enable-lfe-remixing = no
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 9
rlimit-rtprio = 9
daemonize = no

the essential part here is:

default-sample-rate = 192000
alternate-sample-rate = 44100

restart pulse server $ pulseaudio --kill && sleep 1 && pulseaudio --start

oversampling is not always better, but it sounds better in my case, here's an article talks more about oversampling: NOS vs OS (no oversampling vs oversampling)

by the way, under os x, use audio midi setup to set sample rate, not sound in system preferences

Friday, November 23

try clojurescript by following this article: Up and running with ClojureScript in 2018

some cli tools

some notes on creating a graphql mirror/snapshot:

$ npm install -g graphql-cli gql-generator
$ graphql get-schema -e [endpoint] --header FOO=bar -o schema.graphql
$ mkdir queries
$ gqlg --schemaFilePath schema.graphql --destDirPath queries
[ todo ] query and save result to json files
[ todo ] use [json-graphql-server](https://github.com/marmelab/json-graphql-server) to serve data

Monday, November 26, 2018 ##

to watch whether a file is modified, can use inotifywatch, comes from inotify-tools package:

$ sudo apt-get install inotify-tools
$ inotifywatch -mq --form
$ while inotifywait -e modify /path/to/file; do echo "ok"; done

however, inotifywatch was not available under os x, can use fswatch instead:

$ brew install fswatch
$ fswatch -o /path/to/file | xargs -n1 echo

but I found a simpler one, entr, works under both linux and os x:

$ ls /path/to/file | entr echo "ok"

Friday, November 30, 2018

Clojure/conj 2018 videos are up, and will be updated (the conference ends at Dec 1st)

I will finish them all, but first thing first, watched Maybe Not by Rich Hickey, a very good talk about nullable.

and yes I agree that Maybe maybe is not a good idea ...

this year I may try Advent of Code 2018

here's full list of announcements of this year's aws reinvent

I highlighted updates that interested me:

Amazon Kinesis Data Analytics for Java Applications, before you can only use SQL to transform a stream, now with Java support

Firecracker (blog 1 | blog 2), this is huge. a micro-vm for serverless land, hopefully it will solve lambda cold start problem.

Lambda as a Target for Application Load Balancer, you don't need API gateway if you want to trigger lambda by http(s) anymore

Lambda Layers, another huge update for serverless, with this you can run any language on lambda, for example, C++

DynamoDB Transactions (blog 1 | blog 2), dynamodb transactions was supported on sdk level (java), now on the database level. (seems every distributed databases out there are supported transactions now)

Amazon Timestream, time series database, people said it's like a managed druid, wow

AWS Transfer for SFTP, one funny point I heard is treat sftp as an api, interesting ...

Amazon API Gateway support for WebSocket APIs, no info on this yet. before this the only websocket that aws supports is the IoT message broker.

AWS App Mesh, service mesh service, like istio, also build on top of envoy, now wait and see who wins.

Blog Archive