Thursday, March 03, 2016
because of Direct your gopher client to gopher://gopher.metafilter.com, I installed lynx-cur
to test it out (I'm not that old and didn't use gopher before).
I tried couple more text-based web browsers: elinks
and w3m
. I tried to find one that could send url to firefox
, found only w3m
can easily do it:
# add to ~/.w3m/config or /etc/w3m/config
extbrowser firefox &
(on OS X, can use extbrowser open
)
then use M
to open current url in firefox
.
some basic usage of w3m
(hit H
for full list):
| q | exit |
| space | next page |
| b | previouse page |
| esc-l | link list |
| s | go back to buffered history page |
| o | open option panel |
| T | copy current page in a new tag |
| { and } | previous / next tab |
| esc-t | tab list |
| ctrl-t | open link in new tab |
| R | refresh current page |
| U | type in new url |
| L | list link in current page |
| B | go back |
| ctrl-q | close current page |
| ctrl-h | view history |
| ctrl-k | view cookies |
| esc-a | add bookmark |
| esc-b | bookmarks |
gnome-terminal
can't display images while xterm
can.
Friday, March 04, 2016
from the discussion thread of curl vs Wget, learned a couple tricks:
to make curl redirect by default:
echo "-L" >> ~/.curlrc
mirroring a web documentation site:
wget -r -l5 -k -np -p https://docs
from eshell and why can't I convert to you, I learned:
in eshell
, you can cd
to a remote server:
cd /ssh:machine:/home/
M-&
to perform async shell command.
and multi-term
package, but I didn't find it useful and it broke some color themes.
back to clojure, when doing cider-jack-in
, can connect the nrepl
session by:
lein repl :connect localhost:port
useful when working on tmux
.
Monday, March 07, 2016
playing logo programming language with clojure-turtle.
when searching about mysql HA (again), MySQL Router is one thing that I didn't notice before.
and MariaDB 10.1 looks very sexy, here's a guide to set it up on digitalocean.
I want a tool that could log what processes are running on the server, not monitoring a specific process, but seems not easy to find one. until I saw cpustat, take a look at the limitation section will know why there're no tools for this job.
Tuesday, March 08, 2016
lein trampoline run
will not start an extra jvm process, so it's lightweight than lein run
.
I learned it from Clojure Reactive Programming, I just started reading it, quite good actually.
Friday, March 11, 2016
recently switched back from vi mode
to default on bash
, because I'm more comforable with emacs
key bindings now. one thing bothers me is that the reverse search on history, I can't forward a search (ctrl-s
doesn't work).
the answer in here explains why ctrl-s
is not working:
historically (and still today, in some terminals), Ctrl-S pauses the output, and Ctrl-Q resumes it.
stty -ixon
will make it work again. (type stty -a
and check currently is ixon
or -ixon
)
ixon
is enable XON/XOFF flow control
answers from here has another 2 excellent tricks:
"\e[A": history-search-backward
"\e[B": history-search-forward
add above 2 lines to ~/.inputrc
, then when you type a command and press up
or down
arrow key, will search history starting with that.
the other one is use #
to tag a command:
command #tag1 #tag2
then search with the tag:
ctrl+r #tag1
I'm checking the whether keepalived
could be used to provide HA for a nfs
server, this gist has the config as a reference: nfs ha keepalived configure file
checking the seesaw library, playing with Seesaw REPL Tutorial. It's so good, why not everyone is using clojure?
JUXT Radar and The Clojure Toolbox are great resources for clojurian.
looking forward for this book: Optimizing Java : Practical Techniques for Improved Performance Tuning by Benjamin Evans (Java in a Nutshell, Well-Grounded Java Developer) and James Gough
one big news from java community is JEP 286: Local-Variable Type Inference, I found it's funny on the other hand php community is proposing depreciate it.
Saturday, March 12, 2016
clj-ns-browser is an example of using seesaw.
about transducer:
(->> (range 10)
(map inc)
(filter even?)
prn)
;; (2 4 6 8 10)
here 3 sequences were created (range
, map
and filter
), the extra unnecessary allocation could be avoided by transducer:
(def xform
(comp (map inc)
(filter even?)))
(->> (range 10)
(sequence xform)
prn)
same thing applies to core.async
:
(def result (chan 10))
(def transformed
(->> result
(map< inc)
(filter< even?)
(into [])))
;; using transducer
(def transformed
(->> (pipe result (chan 10 xform))
(into [])))
gonna train the slack bot using Markov Chain Carin Meier wrote a tutorial using Markov Chain
also found another simple one clojure-markov-chains, run with
java -cp clojure-1.8.0.jar clojure.main markov.clj
Tuesday, March 15, 2016
fed few text files to train the markov chains bot, the result is not that good. I think a bot that remembers what I told him may be more useful.
read a little bit Mastering Clojure Macros, can't wrap my head around macros, try again later.
Wednesday, March 16, 2016
finally get the Emacs daemon running on my mac, require a shell script though:
#!/bin/bash
NAME=$(whoami)
EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
BIN=/Applications/Emacs.app/Contents/MacOS/bin
if ! $(ps -e|grep -q "[E]macs.*--daemon")
then
$EMACS --daemon=$NAME --user=$NAME
fi
$BIN/emacsclient --socket-name=$NAME -n -c "$*"
change -n -c
above to -t
for running a frame in terminal.
reading Linux Journal Jan 2016 issue, it's funny that feature article is something about cgi, a web server I've nerver heard of and a C program from 2000. but it's using systemd
and mentioned Let's encrypt, so confusing.
the other feature article is much more fun: elasticsearch, syslog-ng and riemann
I thought Riemann is just a monitoring system. but actually it processes streams, well, using clojure is much much better than dealing with logstash
.
didn't pay much attention about difference between .bash_profile
and .bashrc
before, one article in linux journal told the difference. profiles loaded when logged in, rc loaded when an interactive terminal opened.
for large data set, can use the Stack Exchange Data Dump
here's a Script to import the stackexchange dumps into MySQL
Thursday, March 17, 2016
about adding to swap to vm, normally won't need it and not recommended. but I'm running too many things on a $5 droplet ...
here's How To Add Swap on Ubuntu 14.04
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
add to /etc/fstab
:
/swapfile none swap sw 0 0
and tune for vps system, add to/etc/sysctl.conf
:
vm.swappiness=10
vm.vfs_cache_pressure = 50
Saturday, March 19, 2016
emacs evil-mode
I changed using emacs-state
instead of insert-state
, then I can use all emacs movement key bindings when editing. one problem is how to return to normal-state
because Esc
key doesn't work. couple lines are added:
(defalias 'evil-insert-state 'evil-emacs-state)
(define-key evil-emacs-state-map (kbd "<escape>") 'evil-normal-state)
also changed cursor-type
in different states:
(setq evil-normal-state-cursor '(box "purple")
evil-emacs-state-cursor '((bar . 3) "yellow"))
one interesting article recently is tcpdump is amazing, it mentioned pcap
my colleague pointed out that packetbeat supports different sniffer types: pcap
, af_packet
and pf_ring
.
also there is Linux BPF Superpowers
other interesting tools are: sysdig, wireshark
and tshark
I have no particular interest on this area, but I'm reading Practical Packet Analysis
also added these two to reading list:
Thursday, March 24, 2016
good summary of HA options of postgresql: PostgreSQL Replication Solutions (pdf)
citus is very interesting, looks like the way to go: Citus Unforks From PostgreSQL, Goes Open Source
for mysql, check this article: Database High Availability
mysql fabric is one option if you want to keep using innodb
, because mysql cluster
you'll have to use ndb
engine (see MySQL Fabric Frequently Asked Questions)
mysql proxy is another way to separate read/write without touching application level logic: MySQL Proxy FAQ
or maybe try MySQL Load Balancing with HAProxy
facebook has their own solution for scaling the mysql: XDB: Shared MySQL hosting at Facebook scale
Friday, March 25, 2016
there is a DNS Outage at DigitalOcean, it's funny that we build our application with HA and fault tolerance in mind, but we didn't pay much attention to name servers, lesson learned.
Monday, March 28, 2016
podcasts to listen:
- Nathan Marz - Cognicast Episode 095
- SE-Radio Episode 253: Fred George on Developer Anarchy
- SE Radio Episode 249: Vaughn Vernon on Reactive Programming with the Actor Model
- State of Programming with Jeff Atwood - Software Engineering Daily
- What are the differences between Druid and AWS Redshift? - Software Engineering Daily
- Cassandra with Tim Berglund - Software Engineering Daily
- Hadoop: Past, Present and Future with Mike Cafarella - Software Engineering Daily
- Is Scala a better choice than Python for Apache Spark? - Software Engineering Daily
- Apache Kafka's Uses and Target Market - Software Engineering Daily
- Open Source and Rails with Aaron Patterson - Software Engineering Daily
- Socket.IO and Realtime Applications with Guillermo Rauch - Software Engineering Daily
Wednesday, March 30, 2016
when doing pretty output on console, using clojure's print-table
is very easy, for Java I use asciitable.
when listening to Cognicast Episode 095, heard another project by Nathan Marz: specter, check this post: Functional-navigational programming in Clojure(Script) with Specter and this talk: Specter: overcome your fear of nested Clojure data
cascalog is another famous project by Nathan Marz. I saw this library many times in different books, but didn't know it was a project by him until now. (I knew storm and was reading his book Big Data: Principles and best practices of scalable realtime data systems before).
Netflix's Hystrix, I read it from an article back to 2013: Building Clojure services at scale, here's a more recent post about Hystrix: Embracing Failure with Hystrix
there's a clojure bindings for it. I think it's quite useful some of my tasks, better spend some time on it.
Thursday, March 31, 2016
I always looking for a terminal like my old apple II, finally I got it: cool-retro-term
ubuntu is easy:
sudo add-apt-repository ppa:noobslab/apps
sudo apt-get update
sudo apt-get install cool-retro-term
OS X can download the dmg
from their Releases page
if just want the fonts, check out cool-retro-term/app/qml/fonts and True Type VT220 Font
Blog Archive
- Newer Entries
- 2016 April
- 2016 May
- 2016 June
- 2016 July
- 2016 August
- 2016 September
- 2016 October
- 2016 November
- 2016 December
- 2017 January
- 2017 February
- 2017 March
- 2017 April
- 2017 May
- 2017 June
- 2017 July
- 2017 August
- 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
- 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
- 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