RSSAmplifier

Blog

Dan Aloni

Dan Aloni

blog.aloni.orgRSS feed ↗26 posts

Latest posts

Regret Minimization Test

You would save yourself pain if you have the least amount of regrets. After accumulating a life of decisions, it is important to know when to look back. I can test a decision I've made in the past for whether I have a real regret or not. The test goes like this: If hypothetically, I would unequivocally want to send myself a note from the future, straight to the decision time, on which only…

Bash #4 - Bash Docstrings

Previous post: #3 . Once of Python's nice features are docstrings , for which a help function on a module generates a nice documentation screen. Can we follow a similar technique in our bash ? Yes we can! We'll do this as an extension of the functional command relay technique. Adding docstrings can be done by inserting special inner functions that don't execute on command execution.…

Putting Tests in a Separate Git Repo

In the debate on whether to put everything in the so-called mono-repo, system tests are usually not considered a separate codebase. My take on the mono-repo vs multiple-repo debate is "split histories on a stable API boundary", and I think that for system tests this split becomes valid too. With the emerging CI/CD standard stacks that encourage us to put the tests with the code being tested,…

Proper use of Git tags

In the Linux kernel project, the first Git-managed project in existence, due to its proper use of Git tags , the revision v4.11-rc7-87-g28cf22d0ba28 is equivalent to 28cf22d0ba28 . This is due to existence of the annotated v4.11-rc7 tag for an ancestor commit. The nicer string above is the output of git describe 28cf22d0ba28 . The git describe command can relate any commit to tags in the history.…

The SQLite SET-AND Gotcha

In SQLite, suppose that we have the following table: CREATE TABLE IF NOT EXISTS external_data ( name TEXT PRIMARY KEY NOT NULL , atime TEXT NOT NULL , content TEXT NOT NULL ); And we have inserted a row: INSERT INTO external_data VALUES ( " name " , " october " , " a " ); Plus, we have executed an 'upsert' statement: INSERT INTO external_data VALUES ( " name " , " december " , " b " ) ON…

Bash #3 - PATH-wrapping executables

When fixing up complex systems to our advantage we sometimes need to hook on the intermediate execution of a program. The UNIX PATH environment is the venerable search path for programs available in the environment. In this post I'll discuss how to use to wrap around the execution of a program. Previous post: #2 . The PATH environment variable is a : -delimited strings of paths that are…

Rust Turbofish: Closure Return Type

There is a compiler type error in Rust that can happens when you try to pass a closure that returns a Result type. error[E0282]: type annotations needed --> src/main.rs:27:9 | 27 | Ok(()) | ^^ cannot infer type for type parameter `E` declared on the enum `Result` The clue to how to solve this is already in the error message - we need to add type annotations. But why does this happen? Suppose…

Two Endgames For Blockchain and Cryptocurrencies

tl;dr: HackerNews is boiling daily with debates over the merit (or lack-thereof) of cryptocurrencies, bitcoin, and NFTs. I think there are two opposite endgames - all or nothing. The determining factor for widespread maturity of a technology is whether it is necessary for modern quality of life. Electricity, running water, internet in general, internet-based delivery of transportation (Uber),…

Bash #2 - Functional Command Relay

In this post I introduce a nice use for functions in bash . Previous post: #1 . In software projects, would often appear a 'scripts' directory with various scripting utilities. The inexperienced bash scriptwriter would usually not use functions at all and instead litter up the directory with many execution entry points such as: build.sh run.sh deploy.sh If we would like to clean this up…

Bash #1 - Execution Relay

The bash shell is somewhat like the lingua-franca of the UNIX-based shell scripting world, as nothing else manages to displace it. The usefulness of a language is significant if it is omnipresent. In this post I begin a series about programming in bash . Its earlier incarnation sh is less of a concern to me because bash can be found in almost in every place where sh is present. The pitfalls in…

Gitology #2 - git-retext

This is the second post in a series to expand on various utilities I wrote to assist my work with Git. Some of these utilities are located in a repository on GitHub called misc-gitology . Previous post: #1 . Today I'll introduce the commit rewriter - git-retext . Familiar ways of Git history editing In the previous post I mentioned the desire to present a clear Git history to reviewers.…

Gitology #1 - git-flip-history

This is the first post in a series to expand on various utilities I wrote to assist my work with Git. Some of these utilities are located in a repository on GitHub called misc-gitology . Today I'll introduce the history flipper - git-flip-history . The problem with splitting commits When working with Git and browsing other developers' commit history, it is clear to many developers that…

Path Trimming In Nightly Rust

As of yesterday, the Rust PR (which I had worked on) is merged into Rust nightly, and it has wide implications on compiler errors. In this post I describe the change and what to expect from it. The problem with full paths in errors A simple program such as the following, would result in a type error. fn main ( ) { let a = vec! [ vec! [ String :: from ( " a " ) ] ] ; let b = vec! [ String :: from (…

Tracking Linux Kernel Sources of Distributions

TL;DR : I provide easily browsable CentOS kernel sources on GitHub . When developing Linux-based back-end systems, on some situations it is often quite viable to look at Linux kernel sources in order to understand problems. This is true for my clients who design high performance and critical systems, often with kernel code added. However, the source browsing provided by Elixir , though an…

A stack-less Rust coroutine library under 100 LoC

As of stable Rust 1.39.0, it is possible to implement a very basic and safe coroutine library using Rust's async / await support, and in under 100 lines of code. The implementation depends solely on std and is stack-less (meaning, not depending on a separate CPU architecture stack). A very basic simple coroutine library contains only an event-less 'yield' primitive, which stops…

How to Easily Patch Fedora Packages

While many Linux users are developers, a rather small part of the developers feels easy to meddle or extend their distribution's packaging. When there is a pending feature from an upstream package, or when there is a bug in a package, users usually wait for the distribution maintainers to fix it, or resort to use independent solutions such as homebrew , for rebuilding upstream projects.…

Computing Symbolic Gradient Vectors with Plain Haskell

While writing my previous post , I was curious how easy it would be to implement TensorFlow 's automatic differentiation for back propagation. In TensorFlow's web site they call it 'automatic differentiation' but in fact they probably do 'symbolic differentiation', as mentioned in their white paper . The difference between the two relates to whether the…

Intro

I'm a software developer, working as contractor for several companies. When I first learned about the existence of computers I marveled at the ability to program them, and so I taught myself the métier in the mid-1990's. I also hold a B.Sc in computer science. My expertise is a wide arch, ranging from low-level Linux kernel hacking and machine code to compilers, Rust and Haskell…

Back Propagation with TensorFlow

(Updated for TensorFlow 1.0 on March 6th, 2017) When I first read about neural network in Michael Nielsen's Neural Networks and Deep Learning , I was excited to find a good source that explains the material along with actual code. However there was a rather steep jump in the part that describes the basic math and the part that goes about implementing it, and it was especially apparent in the…

Mailing Lists Under GMail

In the Webmail era, E-Mail for group correspondences is often mishandled. Here's how to efficiently handle it in GMail. With many open source projects, you may innocuously subscribe to an Mailing list on the Internet, or you may be unwittingly added to a group mail in an organization (those are often the all@ and dev@ and rnd@ E-Mail prefixes). Your in-box is now bombed with messages that are…

Performance of the ST Monad with Pure Exceptions

The ST Monad provides a venerable method in Haskell for writing stateful imperative code. Writing such code, in contrast to the non-stateful approach, is sometimes better. Some algorithms are better understood or better illustrated with states, and another reason is increased performance. The difference between ST and IO is important, because when we implement an algorithm, we only want to deal…

Toward Better GHC Syntax Errors

As a neophyte to functional programming and Haskell , with full appreciation over the succinctly outputted type errors, for a long time I felt something was remiss with the output of syntax errors. In this post I present a preliminary fix to GHC that improves in the aforementioned arena. Like many other compilers who have not yet forsaken the annotated BNF approach of describing a syntax and…

Build Maneuverings with External Linux Kernel Modules

Much of the material relating to writing Linux kernel modules does not discuss the scenario where you would like to replace existing kernel code or a driver with a wrapping interface, or a whole new implementation of the same component, or another scenario where you have one external kernel module that depends on another. Our Linux kernel is a standalone component and it doesn't like these…

Six Principles of How I Write My Journal

Despite not being a frequent blogger, I am consistent with keeping a private journal that documents my life. The level of depth and introspection achievable with a private journal is different than what can be expected from a public blog or posts in a social network profile (which show mostly an external view), and over the years I have learned about how greatly it contributed to my decision…

Extending Monads for Debugging in Haskell

One of the nice things about Haskell is the ability to extend the class of Monads . One of the original purposes of Monads was to describe flow while leaving the implementation of the flow to a later stage. This allows to define what happens as a side effect of the computational steps. For example, let's say we have a computation that we would like to debug. If we formulate it algebraically,…

Success of VM infrastructure explained by historically crippled OS design

During the last decade we have seen the rise of server and desktop virtualisation infrastructure as the official and standard means of creating services and resources isolation at both the client and server side. System virtualization provided rigid management of computing resources over standardized PC and server hardware for the first time. However when one thinks about it from an engineering…