Friday, July 01, 2016

spent few hours convert my resume to groff, pretty happy with the result. it was quite painful because very little information you can found on google. the best way is the old way: rtfm. (no I didn't do what)

also the manual didn't cover details of macros/preprocessors, so more manuals to read...

these are some useful links:

Saturday, July 02, 2016

one of my old laptop is still using 32bit system, perfect for Dwarf Fortress (even though it might burn the cpu while creating the world...)

when using elinks, to copy current url, just add one more URI Passing:

set document.uri_passing.clip = "echo -n %c | xclip -sel clipboard"

Thursday, July 07, 2016

enjoying my long vacation, not much time for computer.

still reading Learn You Some Erlang for Great Good!

and still reading reddit:

actually I don't have time for this now.

Friday, July 08, 2016

after upgraded ubuntu 16.04, the boot up time is really slow. systemd-analyze blame tells which service costs most time with systemd.

a simple pattern to read input from socket:

(import '[ Socket]
        '[ BufferedReader InputStreamReader])

(let [socket (Socket. host port)
      in (-> socket
  (loop []
    (when-let [n (.readLine in)]
      (println n)

to play mp3 with java, one simple library I found is jlayer

;;[com.googlecode.soundlibs/jlayer "1.0.1-2"]

(import '[ FileInputStream]
        '[javazoom.jl.player Player])

(let [fis (FileInputStream. "stressed-out.mp3")
      player (Player. fis)]
  (.play player))

Sunday, July 10, 2016

java is no fun when working with ssl, I just found few resources and try to work something out:

Monday, July 11, 2016

planck has a ubuntu build, wow it is fast.

antirez wrote a toy editor: kilo, very nice.

I've been doing some basic network programming exercises, will try nio and netty next, for clojure there is a high level library called aleph

some java user groups which are still active and have videos:

Wednesday, July 13, 2016

Polarr is a nice photo editor for ubuntu

saw this game on clojure subreddit: mokepon, something to learn about react and clojurescript

I'm dropping the swf player for my videos, switching to Popcorn.js

one nice thing using a swf video player is I only need to convert to one format: flv, now I have to convert each video to mp4 and webm (probably not gonna do ogv), trouble but not difficult, there is a shell script to do it.

Thursday, July 14, 2016

today checked a couple websites from Internet Archive: Wayback Machine which I built since 2001, lots of memories.

there is a ruby gem to download pages from the wayback machine:

$ sudo gem install wayback_machine_downloader
$ wayback_machine_downloader

Friday, July 15, 2016

to trim a mp4 video using ffmpeg:

ffmpeg -i input.mp4 -ss 00:00:01 -to 00:01:00 -strict -2 out.mp4

about clojure:

other news:

Infinispan, another distributed key-value store library. I knew it when reading Netty in Action.

Apache MINA is a network application framework just like Netty.

Saturday, July 16, 2016

reviewing my oneclj project. actually use lein will be much easier. anyways, at least I learned something from doing it the stupid way.

spent an afternoon to rewrite using lein, the original mvn approach kept in the maven branch.

some notes:

create temparory folder, since java 7 can use

(def temp-dir (java.nio.file.Files/createTempDirectory 
               (into-array java.nio.file.attribute.FileAttribute [])))
even though the 2nd argument for createTempDirectory is optional in java, but not in clojure.

for java methods with varargs, you need at least pass an empty array to it in clojure.

after created the temparory folder, use deleteOnexit to let it removes itself.

(.deleteOnExit (.toFile temp-dir))

the folder won't delete itself if there's files in it, so also need to clean up the folder first or use createTempFile with deleteOnexit.

for uberjar, if you don't want to put temparory files in src folder. can create those files in a temp folder (see above) and add :source-paths ["/tmp/temp-dir"] to project.clj.

doesn't matter where you put your clj files, they will be packed to the root level inside the jar.

Monday, July 18, 2016

reading a blog post by cloudflare from a week ago: Why we use the Linux kernel's TCP stack

it is the kind of article that throws you too much information if you are not in that domain:

since I'm learning network programming now, might worth spending time go through clouldflare's blog posts, especially Marek Majkowski's.

read another Julia Evans blog post: One way to make containers network: BGP, it is not that great.

but Julia Evans is a good learner. she probably looks amature in that topic at this moment, after weeks or months, she's way ahead of you. looking forward to her findings in the container networking area.

even though the blog post is not good, discussion on hacker news is great:

pushed another tiny project to github: usrjim/aws-multi-region-command

I was working on writing a wrapper for awk sdk (php and java), for one particular task I tried clojure (using amazonica ), it was great experience to control things in a repl.

Wednesday, July 20, 2016

today visited a company which uses clojure and datomic, how nice!

I didn't really get start with datomic yet, when I sat with their developers, I learned that Datalog is not just for datomic, there're quite a few implemetions:

Wednesday, July 27, 2016

finished an offsite test, learned few things.

reading a very large file with clojure: be lazy.

(line-seq) is lazy, map is lazy, filter is lazy.

partition the data, map and filter and loop recur them.

to setup a Redis server, arioch/redis puppet module works well.

to import large dataset to Redis, need to use Redis Protocol (see Redis Mass Insertion).

initial import took an hour, just few minutes after changed to use redis protocol.

the task is to count things for a specific time period. using redis' sorted set data type and timestamp as score: ZADD key timestamp value, then ZCOUNT key from-time to-time gives you count of unique item by the range (score), and super fast.

the other task is also about counting unique things, dataset is not large I just fit them in a memory set.

but I'd been looking for a way to handle a larger dataset, HyperLogLog should be a popular algorithm for counting unique items in large dataset.

Redis also has HyperLogLog data structure, the blog post has useful links about HyperLogLog.

for standalone server, there is armon/hlld: C network daemon for HyperLogLogs

they have another interesting project: armon/bloomd: C network daemon for bloom filters

more about these two servers: Armon Dadgar on Bloom Filters and HyperLogLog

some other libraries:

chart presentation is using dimple.

actually I was going to use Quil, but didn't seem to have enough time.

few interesting links:

Thursday, July 28, 2016

episode 5 of defn podcast is about Hoplon, which is the framework used by one of companies I interviewed.

I paired with their developer worked on a simple frontend task, it was fun and I definitely will check out more about Hoplon.

Consider Hoplon is a good start, it modified lein reagent template for hoplon, more simple for lein users.

Some really good real-world clojure recommendations on this reddit thread: Just got my first Clojure job! Any tips for someone using it in production for the first time?

good libraries mentioned in the thread:

Friday, July 29, 2016

a minimal clojurescript setup with figwheel support: (project.clj)

  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.89"]]
  :plugins [[lein-cljsbuild "1.1.3"]
            [lein-figwheel "0.5.4-7"]]
  :clean-targets [:target-path "out"]
  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src/"]
                        :figwheel true
                        :compiler {:main "myproject.core"
                                   :asset-path "js/out"
                                   :output-to "resources/public/js/main.js"
                                   :output-dir "resources/public/js/out"}}]})

lein figwheel will start the dev server and watch files changes.

Sunday, July 31, 2016

got some network problem with my vagrant boxes, I have to drop the NAT and force eth0 to use bridge: "public_network", auto_config: false, :bridge => "wlan0", :adapter => 1

and have to restart network on vagrantup, add this line to /etc/rc.local before exit 0:

ifdown eth0 && ifup eth0

I did my tech news page about 3 years ago, still running node.js and java.

it's time to rewrite it because I probably don't know how to code node.js now. and it's something I can practice hoplon with.

Blog Archives

Search Blog: