Category: Posts
-
C++ split & replace
It’s hard to believe, but after many revisions of the C++ standard, we still don’t have built-in implementations for basic operations like split and replace. See the discussions on Stack Overflow for split and replace. Here are my basic implementations, they should work for most purposes. Split Replace Some tests These implementations seem short and…
-
Productivity notes
Firefox bookmark keywords for quick search Add keywords for quick search on frequently visited sites. For example, it’s so convenient to simply put m car on the search bar and go directly to the definition on Merriam-Webster. Disable search from the address bar in Firefox I don’t like it when Firefox automatically searches for a…
-
Operations notes
Reverse lines in a file In vim, you can select the lines you need to reverse and issue :'<,’>!tac. Source: https://stackoverflow.com/a/742485/526189 Compare two files and get only the difference Source: https://stackoverflow.com/questions/4544709. Prepend data to a file Have rsync print timestamps Use the –out-format option. For example: Source: https://askubuntu.com/a/652532/118883 Upload folder to S3 NOTE: S3 is…
-
Rust notes
-
Programming notes
General concepts Ruby
-
C++: Unordered maps and sets for non-primitive types
Since C++ 11, we can use unordered sets and unordered maps. However, these data structures only seem to work with primitive types and strings. If you need a pair or a vector as the key, you’re out of luck. Fortunately, it’s possible to use unordered containers with other types, we just have to do some…
-
QuickSelect
Theory Implementation in Java Practice
-
Fenwick tree (aka Binary Indexed Tree)
Theory TopCoder – Binary Indexed Trees Algorithms Live – Fenwick tree Wikipedia – Fenwick tree Implementation in C++ Practice Kattis – Movie collection AtCoder – B Fenwick Tree
-
Disjoint Set Union (aka Union-Find)
Theory Algorithms, 4th edition by Robert Sedgewick, Kevin Wayne 1.5 Case Study: Union-Find Union Find on Cubits.ai Implementation in C++ Practice https://atcoder.jp/contests/practice2/tasks/practice2_a
-
Must read
Retries Exponential Backoff And Jitter AWS SDK Retry behavior Error retries and exponential backoff in AWS Example in Java The following example is not meant to be complete, its goal is to give you a good idea of how to configure your AWS clients.