Saturday, September 02, 2017

use emacs as file manager, c-x d to select a directory

| >       | next directory                    |
| <       | previous directory                |
| ^       | up one directory                  |
| c-s     | search                            |
| j       | jump to file                      |
| +       | create directory                  |
| c-x c-f | create file                       |
| s       | sort toggle between date and name |
| g       | refresh                           |
| R       | rename                            |
| C       | copy                              |
| D       | delete                            |
| +       | create directory                  |
| Z       | compress/uncompress               |
| q       | quit                              |

to mark files:

| m   | mark file      |
| u   | unmark         |
| U   | unmark all     |
| %-m | mark by regexp |

to zip multiple file, first use %-m &#46;txt$ to mark all .txt files. then use ! zip output.zip * to apply, * here represents marked files.

hit g to refresh, you'll see the zip file, enter to browse content inside (Zip-Archive mode, q to exit)

editable dired mode:

| c-x c-q | enter editable |
| c-c c-c | apply changes  |
| c-c esc | cancel changes |

to clear dired buffers:

  1. m-x ibuffer
  2. * / to mark all buffers in dired mode
  3. D to kill them

Wednesday, September 06, 2017

started using pass to manage passwords.

to initiate:

$ pass init [gpg-id]

create new password:

$ pass insert mysql/dev-root

retrieve it from clipboard:

$ pass -c mysql/dev-root

password in clipboard will be cleared after 45 seconds.

to generate random passwords:

$ pass insert mysql/dev-root 15

integrate with git:

$ pass git init
$ pass git push
$ pass git pull


not much special about this article: Why favor PostgreSQL over MariaDB / MySQL

more interesting are discussions on hackernews and reddit


since people mentioned about mysql 8.0.2 supports window functions, found out that I don't know many things about mysql:


I'm reading The Language of SQL (2nd Edition), not deep, so it's good to me.

the book's examples are for ms sql, but it also lists out compatibility with oracle and mysql.

I learned some of limitation about mysql from it, accidentally learned some new things about mysql 8.

I bookmarked this article: JOIN Elimination: An Essential Optimiser Feature for Advanced SQL Usage

didn't have time to read it before, I'll do it once finished reading the SQL book.


this tutorial teaches you How to Build a Simple Database

I always like this kind of stuffs, build some important components from scratch. not necessarily for serious use, but you'll know what is a good service looks like and what is the difficult part of it.

I begin to write a pub-sub server, I'll do load balancer next. I think that will be fun.


saw one colleague using lua script for redis, I should give it a try as well.

but I want to know when should you use lua script instead of redis clients.

lua script blocks, and redis is single-threaded.

it should be something quick and lua makes clean.

a guide to begin:

Thursday, September 07, 2017

finished The Language of SQL (2nd Edition), not bad.


now reading Designing Data-Intensive Applications, it is a very good one.

chapter 3 starts by a bash version key-value database, then apply different index solution from there. super easy to understand.

Saturday, September 09, 2017

aws announced Network Load Balancer

it's a level 4 load balancer with fixed IP and cross zones. also provided health checks on targets.

this will be super useful if you have custom services running. a static ip means no cname and ip cache problem. aws maintain the floating ip for you.

I had to setup a nfs server with failover before, I wish this was available at that time.


nginx released NGINX Unit

to be honest I don't see the point yet.


Vagrant 2.0 is out.

I still prefer vagrant over docker

vagrant is the whole environment, containers are just processes, you'll need docker compose or kubernetes or you own bash to maintain the relationships

Wednesday, September 13, 2017

I decided to learn python, reading Python Crash Course now.

Wednesday, September 20, 2017

I found myself using more and more tig:

  • Tab: Switch to next view
  • R: Reload and refresh the current view
  • #: Toggle line numbers on/off
  • ~: Toggle (line) graphics mode
  • e: Open file in editor
  • :<sha>: Jump to a specific commit
  • f: Switch to (file) blob view

can find file with fuzzy search

  • g: Switch to grep view

find content in any files

  • b: Switch to blame view.
  • s: Switch to status view.

here, you can stage / unstage files (like git add -i), and press C to commit (calls external git commit command).

for more details check the tig manual


taken from 30 interesting commands for the Linux shell:

2. Kill program using one port

sudo fuser -k 8000/tcp

4. Rename selected files using a regular expression

rename 's/\.bak$/.txt/' *.bak

13. Grep with Perl like syntax (allows chars like \t)

grep -P "\t"

16. Run command every time a file is modified

while inotifywait -e close_write document.tex
do
    make
done

20. Randomize lines in file

shuf file.txt

27. Create empty file of given size

fallocate -l 1G test.img

29. Monitor the progress in terms of generated output

cat /dev/urandom | base64 | pv -lbri2 > /dev/null

Thursday, September 21, 2017

Java 9 will release today.

the best talk I've seen on Java 9 is Clojure, Java 9, and You - Toby Crawley

I think a lot of Java 9 articles are coming.


finished Python Crash Course, not bad. but looks like python is really easy, very similar to javascript + php

the only surprise thing to me ispython prefers list comprehension over map and filter, and reduce is moved to funtools package.

lambda only uses for one-liner function.

I also tried reading Fluent Python, quite low level, and to be honest I don't like magic methods.

now reading Effective Python: 59 Specific Ways to Write Better Python, so far so good.


also reading a free book: Fast Data Architectures for Streaming Applications

it is a good introduction on modern big data architectures, recommended.


Blog Archives

Search Blog: