Algorithms to Live By

A few weeks ago I started reading Algorithms to Live By: The Computer Science of Human Decisions and been fascinated by it ever since:

What should we do, or leave undone, in a day or a lifetime? How much messiness should we accept? What balance of the new and familiar is the most fulfilling? These may seem like uniquely human quandaries, but they are not. Computers, like us, confront limited space and time, so computer scientists have been grappling with similar problems for decades. And the solutions they’ve found have much to teach us.

In a dazzlingly interdisciplinary work, Brian Christian and Tom Griffiths show how algorithms developed for computers also untangle very human questions. They explain how to have better hunches and when to leave things to chance, how to deal with overwhelming choices and how best to connect with others. From finding a spouse to finding a parking spot, from organizing one’s inbox to peering into the future, Algorithms to Live By transforms the wisdom of computer science into strategies for human living.

I’ll try and give you a little taste of the book - which I’m still reading (more precisely, listening), so you’ll know what you’re getting into.

Read More

Making Hexo Blazing Fast

A week ago I migrated my blog from Ghost to Hexo to gain better performance and save money.

Hexo is said to be “Blazing Fast”, but while I did “feel” that my Hexo based site was snappier than its predecessor, it was far from “Blazing Fast”.

Performance is extremely important. There are a lot of articles on the subject, most of which point out that website performance & uptime are key to user satisfaction. WebpageFX wrote a nice summary of the subject - Why Website Speed is Important.

I’m not a web developer, and have almost zero knowledge in website optimizations. Nonetheless, I’ve optimized more then a few apps in my career and know how to approach such problems.

All I need is to figure out the tooling to find the bottlenecks and fix them to gain good enough performance. That is, I’m not looking into optimizing every single piece of the website, only making it fast enough so it’ll feel snappy.

This blog post explains the steps I took in order to dramatically decrease the average page size to less then 350k.

Read More

coroutines: basic building blocks for concurrency

This part of the series explains the basic building block that allow writing concurrent programs in python.

Later in the series I’ll show how to use different async paradigms using the new async syntax that was (finally) introduced in Python 3.5.

Prerequisites

  1. You’re using python 3.6.x
  2. You’re familiar with coroutines. otherwise, read - coroutines: Introduction.

Read More

Becoming the go-to guy for Linux internals

7 months ago I made a new years resolution to master vim: The Road to Mastering Vim.
I’m not a master just yet, it’s going to take a few years. After 7 months of exclusively editing text & code with vim, I can honestly say that I’m feeling at home and I can’t go back.

A few days ago I told the world that I’m moving to Cybereason. I didn’t say that I’m going as hard core as it gets - joining the team that develops the agent on Linux endpoints.

New Role → New Challenges.

Read More

Running, Editing & Debugging .NET Core Apps Inside a Container

Today I needed to add a few features to an existing .NET Core application. I’m running Fedora 25, but that shouldn’t be an issue, right? because -

It appears that it doesn’t love Fedora 25, because it’s still not officially supported. Instead of hacking around and trying to get this thing working, and wasting my whole day doing so, I thought - why not use Docker?

The idea was simple - create a container that fires up Visual Studio Code inside a container that has .NET Core installed.

Read More

names generator à la docker

I really like docker’s names generator. It makes remembering id’s easier, and as of version 0.7.x, it generates names from notable scientists and hackers, which gives it an extra bonus!

There are a number of ports out there (shamrin/namesgenerator for example), but all of them just copy-and-paste the names, which is not cool at all.

I decided to parse names-generator.go and extract the names from it, thus making sure it’s always up to date.

I wrote two implementations, one in python and one in go.

  • python: parses the code directly using regular expressions
  • go: parses the code using go’s AST package, and spit python code to stdout.

^ The hyperlinks lead to the relevant section in the blog post.

The amount of lines needed to do all that work is relatively short, which shows how powerful these languages are.

Read More

Accidentally destroyed production database on first day of a job, how screwed am I?

I just read a post on reddit titled: Accidentally destroyed production database on first day of a job, and was told to leave, on top of this I was told by the CTO that they need to get legal involved, how screwed am I?

TL;DR

  • Guy get a document detailing how to setup a local development environment.
  • Guy sets up a development database
  • Guy runs a tool that performs tests on the application. accidentally, pointed the tool against the production database.
    • The credentials for the production database were in the development document
    • The tool clears the database between tests
  • Guy gets fired

I’m completely pissed! The guy made an honest mistake that can happen to anyone, and gets fired!

Read More