Tuesday, September 01, 2020
learn about this book from applebot story:
Introduction to Information Retrieval
Sunday, September 06, 2020
playing with the Fennel programming language
$ brew install luarocks
$ luarocks --local install fennel
$ luarocks --local install readline
install fennel-mode for emacs
C-u M-x run-lisp RET
to start a repl
C-c C-z
- Start or switch to repl bufferC-c C-e
- Evaluate current top-level formC-c C-r
- Evaluate the regionC-c C-k
- Reload the module for the current file (requires fennel.seacher)C-c C-d
- Ask for a value and show its docstring in the replC-c C-l
- Display compilation output for the current fileM-.
- Jump to the definition of the function at pointM-,
- Jump back to where you were before jumping to definition(let [f (assert (io.open "a.txt"))] (print (f:read "*a")) (f:close)) (each [line (io.lines "a.txt")] (print line)) (let [f (assert (io.open "a.txt"))] (each [line (f:lines)] (print line)) (f:close))
Monday, September 07, 2020
reading Python for DevOps
Wednesday, September 09, 2020
kind of finished Python for Devops, not much interesting stuffs in later chapters.
now reading Flask Web Development
Wednesday, September 16, 2020
read this thread I use WordPerfect 6.2 for DOS, not for any nostalgia or legacy reasons, just because ... and then this post: How to Use Classic Amiga for Word Processing Today (2 of 2)
so I started trying Amiga, it was fun and some links I collected:
- FS-UAE Amiga Emulator
- AmigaOS Manual: AmigaDOS Command Reference
- Amiga-FAQ - Compilers
- SAS C Compuler
- Fred Fish's Amiga Freely Redistributable Software Library
- Aminet - util/arc/lha.run
things I wanna try:
- Introducing Pebble: A RocksDB Inspired Key-Value Store Written in Go
- JDK 15: The new features in Java 15
- Emacs Prelude 1.0
I didn't read for so long, here's reading list I want to pick up:
- Mastering Python Networking - Third Edition
- 40 Algorithms Every Programmer Should Know
- Practices of the Python Pro
- Modern Python Cookbook - Second Edition
- Black Hat Go
- gRPC: Up and Running
- Using Asyncio in Python
- Container Security
- Pandas 1.x Cookbook
- Effective C
- Codeless Data Structures and Algorithms : Learn DSA Without Writing a Single Line of Code
- Building Event-Driven Microservices
- Architecture Patterns with Python
- Data Management at Scale
- High Performance Python, 2nd Edition
- Fundamentals of Software Architecture
- Database Internals
vim
special registers:
"
: default register%
: current file path:
: most recently executed command.
: the last inserted text
insert mode to access registers: use ctrl-r [register]
can also run command using ctrl-r =
:
ctrl-r = system('ls') <enter>
Thursday, September 17, 2020
trying Emacs Prelude
I'm kind of giving up on my personal emacs config and just kept the minimal, it's very nice that it comes with many language support.
$ curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
edit prelude-modules.el
to enable language support, it's very simple
to update, just M-x prelude-update
for custom setup, put snippets in personal/preload/
(setq prelude-flyspell nil)
(setq prelude-guru nil)
(setq prelude-minimalistic-ui t)
(setq prelude-theme nil)
(setq make-backup-files nil)
(setq prelude-whitespace nil)
it comes with some useful shortkeys too:
C-c f
: Open recently visited file.C-S-up
: Move the current line or region up.C-S-down
: Move the current line or region down.C-c d
: Duplicate the current line (or region).C-c k
: Kill all open buffers except the one you're currently in.C-c . +
: Increment integer at point. Default is +1.C-c s
: Swap two active windows.C-c i
: Search for a symbol, only for buffers that contain codeC-c U
: Search in Duckduckgo for the thing under point (or an interactive query).Cmd-p
: projectile prefixCmd-j
: join lineCmd-k
: kill whole lineCmd-o
: Insert an empty line above the current line and indent it properly.Cmd-RET
: Insert an empty line and indent it properlyM-Z
: Zap up to char.
Reveal: Read Eval Visualize Loop for Clojure is very cool, the best thing is I can navigate previous results via tabs, like pandas
to start is easy:
$ clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.0.128"}}}' -m vlaaad.reveal repl
Tab
to switch between output and resultCtrl ←
andCtrl →
to switch tabsEsc
to close tab$ clj -A:reveal -J-Dvlaaad.reveal.prefs='{:theme :light}' -m vlaaad.reveal repl
or create an alias by add this block to ~/.clojure/deps.edn
, under :aliases
:
{:reveal {:extra-deps {vlaaad/reveal {:mvn/version "1.0.128"}}
:main-opts ["-m" "vlaaad.reveal"]
:jvm-opts ["-Dvlaaad.reveal.prefs={:theme,:light}"]}}
and then just simply run
$clj -A:reveal repl
to use it in an existing leiningen project is also easy, add the dependency to project.clj
:
:profiles {:dev {:dependencies [[vlaaad/reveal "1.0.128" :exclusions [org.clojure/clojure]]]}}
to only show tapped value:
(ns myapp.core
(:require [vlaaad.reveal :as reveal]))
(add-tap (reveal/ui))
(tap> {:foo 1})
to start nrepl with reveal (then can use cider-connect
):
first create .nrepl.edn
in project root:
{:middleware [vlaaad.reveal.nrepl/middleware
cider.nrepl/cider-middleware]}
then start the nrepl server with
$ lein run -m nrepl.cmdline
(or build-in client)
$ lein run -m nrepl.cmdline -i
then can use emacs
to connect to it.
Saturday, September 19, 2020
found this tool when browsing github:
borkdude/babashka: A Clojure babushka for the grey areas of Bash
introduction video: Babashka and Small Clojure Interpreter: Clojure in new contexts
I used to use single frame on emacs, now I'm more comfortable with multiple frames that I don't need to switch buffers all the time:
C-x 5 C-f find-file-other-frame
C-x 5 C-o display-buffer-other-frame
C-x 5 0 delete-frame
C-x 5 1 delete-other-frames
C-x 5 2 make-frame-command
C-x 5 d dired-other-frame
C-x 5 f find-file-other-frame
C-x 4 C-f find-file-other-window
C-x 4 C-j dired-jump-other-window
C-x 4 C-o display-buffer
C-x 4 b switch-to-buffer-other-window
C-x 4 d dired-other-window
C-x 4 f find-file-other-window
ace-window
supports multiple frames (c-x o
under Emacs Prelude)
- c-x tab`, use arrows to move the region
c-x <left>
: next bufferc-c <right>
: winner undeo
m-x package-install embrace
, then use m-x embrace-change
to change quote pairs
some notes on redis
$ sudo pip install redis fake2db
$ bin/redis-cli flushall
$ fake2db --rows 10000 --db redis
127.0.0.1:6379> DBSIZE
(integer) 50000
// this takes a while
127.0.0.1:6379> KEYS *
// use scan instead
127.0.0.1:6379> scan 0
127.0.0.1:6379> EXISTS "simple_registration:7681"
(integer) 1
127.0.0.1:6379> TYPE "company:3859"
hash
// rename key
127.0.0.1:6379> RENAME "customer:6591" "customer:6591:renamed"
OK
calling the KEYS
command is dangerous, use SCAN
, HSCAN
or SSCAN
If the key to be deleted is a data type other than string, you may encounter server latency when the number of elements in the key is large. Use UNLINK
instead of DEL
. It will perform the deletion in another thread rather than the main event loop thread, so it won't block the event handling.
RENAME
will delete the target key if it has already existed. Therefore, the best practice for renaming is to UNLINK
the target key if it exists, and then do the renaming.
The command DUMP/RESTORE
can be used for serialization and deserialization. You can use these two commands to make partial backups for Redis.
read Introducing Deno, I'll re-visit deno later.
didn't use paredit for a long time:
M-(
wrap around`
moving right parenthese in/out
C-S-left
/ C-S-right
M-}
/ M-)
moving left parenthese in/out
C-M-left
/ C-M-right
M-{
/ M-(
M-s
kill parenthese
Sunday, September 20, 2020
almost forgot how to start a *cider-scratch*
looks like nrepl
still easier in emacs
make sure ~/.lein/profiles.clj
has:
{:user {:dependencies [[org.clojure/tools.nrepl "0.2.13"]]
:plugins [[cider/cider-nrepl "0.25.3"]]}}
I like to start server in termnial instead of inside emacs start a nrepl
server anywhere even without a project:
$ lein repl :headless &
start *cider-scratch*
and cider-connect
to it
I would like to use prepl
too, I was using it under vim and with conjure but need to research is there an easy way to do it in emacs ...k
I also updated the reveal alias:
:aliases {:reveal {:extra-deps {nrepl {:mvn/version "0.8.2"}
org.clojure/tools.nrepl {:mvn/version"0.2.13"}
cider/cider-nrepl {:mvn/version "0.25.3"}
vlaaad/reveal {:mvn/version "1.0.128"}}
:main-opts ["-m" "nrepl.cmdline"
"--middleware"
"[cider.nrepl/cider-middleware,vlaaad.reveal.nrepl/middleware]"]
:jvm-opts ["-Dvlaaad.reveal.prefs={:theme,:light,:font-size,16}"]}
Monday, September 21, 2020
finally reading Programming Clojure 3rd edition, I read 2nd edition before, this time focus on spec
Sunday, September 27, 2020
adding more books to reading list:
- Quarkus Cookbook
- Effective TypeScript
- Istio: Up and Running
- Practical Time Series Analysis
- Solving Identity Management in Modern Applications
- BPF Performance Tools: Linux System and Application Observability
- Practical Statistics for Data Scientists
currently reading Database Internals and Modern C
Blog Archive
- Newer Entries
- 2020 October
- 2020 November
- 2020 December
- 2021 January
- 2021 February
- 2021 March
- 2021 April
- 2021 May
- 2021 June
- 2021 August
- 2021 September
- 2021 December
- 2022 March
- 2022 April
- 2022 May
- 2022 June
- 2022 July
- 2022 August
- 2022 September
- 2022 October
- 2022 November
- 2022 December
- 2023 January
- 2023 February
- 2023 March
- 2023 April
- 2023 July
- 2023 August
- 2023 September
- 2023 October
- 2023 November
- 2023 December
- 2024 January
- 2024 February
- 2024 March
- 2024 April
- 2024 May
- 2024 June
- 2024 August
- 2024 September
- 2024 October
- 2024 November
- Older Entries
- 2020 August
- 2019 December
- 2019 November
- 2019 October
- 2019 July
- 2019 May
- 2019 April
- 2019 March
- 2019 February
- 2019 January
- 2018 December
- 2018 November
- 2018 October
- 2018 September
- 2018 August
- 2018 July
- 2018 June
- 2018 May
- 2018 April
- 2018 March
- 2018 February
- 2018 January
- 2017 December
- 2017 November
- 2017 October
- 2017 September
- 2017 August
- 2017 July
- 2017 June
- 2017 May
- 2017 April
- 2017 March
- 2017 February
- 2017 January
- 2016 December
- 2016 November
- 2016 October
- 2016 September
- 2016 August
- 2016 July
- 2016 June
- 2016 May
- 2016 April
- 2016 March
- 2016 February
- 2016 January
- 2015 December
- 2015 November
- 2015 October
- 2015 September
- 2015 August
- 2015 July
- 2015 June
- 2015 May
- 2015 April
- 2015 March
- 2015 February
- 2015 January
- 2014 December
- 2014 November
- 2014 October
- 2014 September
- 2014 August
- 2014 March
- 2014 February
- 2014 January
- 2013 December
- 2013 October
- 2013 July
- 2013 June
- 2013 May
- 2013 March
- 2013 February
- 2013 January
- 2012 December
- 2012 November
- 2012 October
- 2012 September
- 2012 August