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:
- lots of papers from this question: What's new in purely functional data structures since Okasaki?
- learn how to build a dashboard: Mini framework for building dashboards
- learn some game tricks: Open Source Android Terraria/Minecraft Clone Developed Using Java
- learn how to build video chat app: Video Conference Part 1: These Things Suck
- learn something new from clojure
1.9
: Clojure 1.9 alpha 8 is out! Many updates/changes to spec.
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 '[java.net Socket]
'[java.io BufferedReader InputStreamReader])
(let [socket (Socket. host port)
in (-> socket
.getInputStream
InputStreamReader.
BufferedReader.)]
(loop []
(when-let [n (.readLine in)]
(println n)
(recur)))
to play mp3 with java, one simple library I found is jlayer
;;[com.googlecode.soundlibs/jlayer "1.0.1-2"]
(import '[java.io 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:
- A HTTPS client and HTTPS server demo in Java
- aphyr/less-awful-ssl: Sssh no tears, only TLS now. For Clojure.
- Java 2-way TLS/SSL (Client Certificates) and PKCS12 vs JKS KeyStores
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 http://example.com
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:
- Nightcode is a IDE for clojure, it is good. how come I didn't hear about it before?
- defn new episode #05 - Hoplon Special with Micha Niskin by defn
- Clojure spec Screencast: Leverage
other news:
- digital ocean released a highly available block storage
- dropbox released lepton, a new streaming image compression format, good to use it on my old photo archive
- jepsen did a test on voltdb 6.3
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
"prefix-string"
(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:
- Time-sharing
- IRQ storm
- netmap - the fast packet I/O framework
- what they mean With this the kernel retains the ownership of the network card, and allows us to perform a bypass only on a single "RX queue": Single RX queue kernel bypass in Netmap for high packet rate networking
- about RFC4821 PMTU discovery, the RFC, the blog post: Path MTU discovery in practice and discussion on hacker news
- also the original post by Julia Evans: Why do we use the Linux kernel's TCP stack?
- and discussion on hacker news: Why do we use the Linux kernel's TCP stack? | Hacker News
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:
- Project Calico | A Pure Layer 3 Approach to Virtual Networking
- coreos/flannel: flannel is an etcd backed network fabric for containers
- Why Kubernetes doesn't use libnetwork
- kubernetes-the-hard-way: Bootstrap Kubernetes the hard way.
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:
- datascript: Immutable database and Datalog query engine for Clojure, ClojureScript and JS
- bacwn: clojure + datalog = <3
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:
- bigmlcom/sketchy: Sketching Algorithms for Clojure (bloom filter, min-hash, hyper-loglog, count-min sketch)
- addthis/stream-lib: Stream summarizer and cardinality estimator.
chart presentation is using dimple.
actually I was going to use Quil, but didn't seem to have enough time.
few interesting links:
- 500 Lines or Less is the latest book from aosa series. pdf link is here
- Machine Learning is Fun! Part 4: Modern Face Recognition with Deep Learning
- The Uber Engineering Tech Stack, Part I: The Foundation
- Why Uber Engineering Switched from Postgres to MySQL
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:
- onyx-platform/onyx: Distributed, masterless, high performance, fault tolerant data processing
- ztellman/aleph: asynchronous communication for clojure
- brettwooldridge/HikariCP: 光 HikariCP・A solid high-performance JDBC connection pool at last.
- JitPack | Easy to use package repository for Git
- metosin/compojure-api: Sweet web apis with Compojure & Swagger
- H2 MVStore
- clojure/tools.logging: Logging macros which delegate to a specific logging implementation.
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
:
config.vm.network "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 Archive
- Newer Entries
- 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
- 2024 December
- Older Entries
- 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