Tuesday, August 08, 2017
watched some video talks today:
- Git Anti Patterns How Mess Up With Git And Love It Again by Lemi Orhan Ergin
- Turning the JVM into a Polyglot VM with Graal
- Pattern Matching with Brian Goetz
the pattern matching talk is good, you can see how hard to put a new feature into java, but Brian Goetz explains very well and I always think they made the right tradeoffs. (I still want to know the reason why Rich Hickey doesn't like the matching part, must be something)
also put these to watch list:
- GOTO 2017 • Serverless Chatbots with Amazon Lex & AWS Lambda
- Build and Deploy Containerized Redis Cache for High Availability and Performance
- Event Bus as Backbone for Decoupled Microservice Choreography
my colleague shows me a trick:
man ls | less +/pattern, it will search
pattern on start
I used to jump to specific line with vim by using
vim +4 file, so I think maybe vim supports it as well.
I want to jump to end of file on opening, tried
vim +G file, doesn't work.
vim + file can jump to end of file, but to put cursor to end of line, need this:
vim "+normal G$" (or
pretty cool, I'd like to develop something for terminal using clojure.
someone in the discussion mentioned
ed, I realized I didn't know how to use it, I'll start my study on it: Actually using ed
emacs, the editor I didn't use for quite a while:
to disable buffer coloring:
(global-font-lock-mode 0) to init, however, doesn't work for me.
Wednesday, August 09, 2017
to enable netbeans terminal key repeat under os x:
$ defaults write -g ApplePressAndHoldEnabled -bool false
tried fireplace.vim today, simple and good enough for me to write clojure, similar to emacs'
- start a
- open the
cljfile ane run
:Connect, then enter the host and port
cppfor the innermost form under the cursor
cqbring up a command-line window
cqqprepopulates the command-line window with the expression under the cursor.
cqcgives you a blank line in insert mode.
Kis mapped to look up the symbol under the cursor with doc.
[dis mapped to look up the symbol under the cursor with source.
[<C-D>jumps to the definition of a symbol (even if it's inside a jar file).
gf, everybody's favorite "go to file" command, works on namespaces.
the flow is fater than
cider and I can close the editor anytime.
Thursday, August 10, 2017
go talks has their own slide tool:
$ go get golang.org/x/tools/cmd/present
then write a
.slide, in the format specified by here
present your-file.slide, it serves your slide with
can check Go talks repo for reference.
one nice thing of it is you can run code snippets in your slides,
present also opens a websocket to receive snippet and send result back to the channel. (for php, ruby etc, remember add shebang
#! on top)
Saturday, August 12, 2017
moving my hosting from digital ocean to vultr, for the same price vultr provides double memory.
I forgot how to setup servers alreay...
for 2FA setup:
$ apt-get install libpam-google-authenticator $ google-authenticator
follow instructions to setup google authenticator for current user.
then update sshd to support it:
# add this line at the top auth required pam_google_authenticator.so nullok
ChallengeResponseAuthentication yes PasswordAuthentication yes LoginGraceTime 30 PermitRootLogin yes StrictModes yes MaxAuthTries 3
remember keep an active session before restart
I don't know how to deal with
ipv6, so I just disabled it:
echo "net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee /etc/sysctl.d/99-my-disable-ipv6.conf sudo service procps reload
I always like the simplicity of
ufw default deny incoming ufw default allow outgoing ufw allow 80/tcp ufw allow 22/tcp ufw status verbose
Sunday, August 13, 2017
boot repl to start a
nrepl server, then use
m-x cider-connect or
m-x inf-clojure-connectconnect my script to it
they both works and I don't have preference now.
there's an important function though, put it in
boot repl runs:
(defn deps [new-deps] (merge-env! :dependencies new-deps))
it allows me to include new dependencies without restart the repl.
Monday, August 14, 2017
watched two talks from infoq, both good:
Tuesday, August 15, 2017
to put a java program runs as service under ubuntu, save following to
[Unit] Description=myservice After=network.target [Service] WorkingDirectory=/home/user/jars EnvironmentFile=/home/user/jars/jar_env Restart=always RestartSec=5 ExecStart=/usr/bin/java -jar /home/user/jars/myservice.jar [Install] WantedBy=default.target
then load the service file:
systemctl –user daemon-reload
and start service:
systemctl –user start myservice
watched two talks about microservices:
the first two
sharding are really good
streaming are more like advertisement for kafka, ruined the whole talk.
this talk is a little bit more detailed than GOTO 2016 • The Verification of a Distributed System • Caitie McCaffrey
I hate writing tests, but I agree generated tests are useful and make much more sense to me.
John Hughes - Don't Write Tests is a talk about generated tests using quickcheck
from the talk I watched: Clojure Spec: Expressing Data Constraints without Types
clojure spec makes generating tests much easier
test.check is a quickcheck for clojure
I had some intensive reading on laravel, I really don't like it.
just take a look at the Authentication part.
provider, should be some classes right? where are they? I have no idea.
then you'll find internally they're passing around using interfaces (Contract in their term), where is the implementation? no idea.
finally somewhere in the config, there're relationships of interfaces and the actual implementation class, it's one to one relationship, why use interface then?
methods often come from nowhere because there're
and the best practice part: don't put logics in controllers because it's hard to test, put logics in services, and no logics in models as well, repositories are the right place. views are not flexible, need transformers. seriously?
I miss codeigniter a lot, it maybe not as modern as laravel, but I don't see so many wrong abstraction in it. most importantly, it's simple.
I heard good comments about gin-gonic/gin, I'm going to give it a try.
Thursday, August 17, 2017
I'm watching clojure talks again:
- Chicago Clojure - Stuart Halloway on Repl Driven Development
- otplike – Erlang/OTP processes and behaviours for Clojure
clojure startup time is still a topic, Eric Normand also shares his workflow
Saturday, August 19, 2017
when I want to send a file to colleague, I usually starts a
$ nc -l [port] < file-to-send
then ask them to get it using
$ nc [my-ip] [port] > save-to-file
however, the connect is very insecure.
I found an utility from
nmap does support
first, generate a new cert:
$ openssl req -new -x509 -keyout test-key.pem -out test-cert.pem
to serve a file:
$ ncat -l --send-only --ssl --ssl-cert test-cert.pem --ssl-key test-key.pem < file-to-send
default port is
31337, you can add verbose flag
-v to inspect.
to receive file from another machine:
$ ncat --recv-only --ssl host-name > save-to-file
ncat should be closed the connection once done. without them, you'll need to use
ctrl-c or set timeout to close it.
it's very easy. actually I was thinking to write a go program to generate the cert and serve with https. I might still do that but the priority is low now.
I really want to make my emacs works under terminal, however, it's very difficult. I have many keys rely on combination what won't support by the terminal.
Sunday, August 20, 2017
this, can apply to microservices in my opnion. the old 3-tier architecture scales pretty well, and it's simple.
it reminds me I need to dig deep into SQL.
another article is not as popular as the one above, but I like it: Small Functions considered Harmful
Monday, August 21, 2017
reading Working with Linux – Quick Hacks for the Command Line, not deep, learned couple tips from it:
encrypt file in vim
set cryptmethod=blowfish (default is just zip, newer vim version supports
then open a file, enter
:X, it asks you for a key to encrypt the file.
once you saved the file, content is encrypted. next time you open the file, enter the same key to decrypt it.
for emacs, by default it uses EasyPG
even better, you can highlight a region and just encrypt it by
m-x epa-encrypt-region with a key.
select the encrypted region and use
m-x epa-decrypt-region and enter same key to decrypt it.
once again, emacs is better :p
set default value for bash var
usually I'll just use
$1 to accept conditional input for my bash scripts
I learned from the book I can set a default value by using
append the default value after
I won't try to remember all bash patterns, they are so weird, like
the default value one is simple and easy to remember.
Friday, August 25, 2017
I mentioned share file via
ncat with ssl above, however, I still wanted to write the program.
so spent a night to develop a simple program with go: goserve
more on TLS in go: Hitless TLS Certificate Rotation in Go
by the way, Go 1.9 is released today
The Automatic Clearing House (ACH) network is the primary way money moves electronically through the banking system today.
I'm working on a virtual currency system now, so I need to finish this series.
reading Linux Phrasebook (2nd Edition)
it is very very good, it explains linux system concisely, my understanding with linux becomes more solid after I read it.
I remember I read another phasebook before, The Go Programming Language Phrasebook, also a very good one.
I don't know, I can't use
I still want to try common lisp again, since I'm more comfortable with parentheses now.
and cs papers:
youtube, I watched some these days:
I listened to Michael Nygard on cognicast, then I went to watch his talks.
he has very deep and solid knowledge, I'm looking forward to his Release It! Second Edition
the talk is good, but if you already read release it, you'll know he will deliver high quality content.
pep 8 is style guide for python code, I don't code python, but I still found this talk useful.
your code follows style guide, covered with tests, doesn't mean it's good. good code is difficult, I'm still learning.
- Older Entries
- 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
- Newer Entries
- 2017 September
- 2017 October
- 2017 November
- 2017 December
- 2018 January
- 2018 February
- 2018 March
- 2018 April
- 2018 May
- 2018 June
- 2018 July
- 2018 August
- 2018 September
- 2018 October
- 2018 November
- 2018 December
- 2019 January
- 2019 February
- 2019 March
- 2019 April
- 2019 May
- 2019 July
- 2019 October
- 2019 November
- 2019 December
- 2020 August
- 2020 September