|
Problem: Estimate the number of distinct items in a data stream that is too large to fit in memory. Solution: (in python) import random def randomHash(modulus): a, b = random.randint(0,modulus-1), random.randint(0,modulus-1) def f(x): return (a*x + b) % modulus return f def average(L): return sum(L) / len(L) def numDistinctElements(stream, numParallelHashes=10): modulus = 2**20 hashes = [randomHash(modulus) for _ in range(numParallelHashes)..
|
|
I often find myself creating one-off scripts to scrape data off websites for various reasons. My go-to approach for this is to hack something together with Requests and BeautifulSoup , but this was getting tiring. Enter Cyborg , my library that makes writing web scrapers quick and easy. Cyborg is an...
|
|
I often find myself creating one-off scripts to scrape data off websites for various reasons. My go-to approach for this is to hack something together with Requests and BeautifulSoup , but this was getting tiring. Enter Cyborg , my library that makes writing web scrapers quick and easy. Cyborg is an...
|
|
One of the key elements of personal finance is separating "needs" from "wants". Every guide to controlling your budget usually starts with…
|
|
Been a fan of highlight-thing-mode . It automatically highlights all instances of symbol at point. Today, I gave highlight-symbol a try. Similar concept, but also adds the ability to jump to next/previous instances of symbol at point. (use-package highlight-symbol :ensure t :config (set-face-attribute 'highlight-symbol-face nil :background "default" :foreground "#FA009A") (setq highlight-symbol-idle-delay 0) (setq highlight-symbol..
|
|
From Gandhi: Radical Wisdom for a Changing World : Anger "I do get angry, but I feel angry with myself for it. Full conquest of anger is possible only through self-realization. We should love even those who have the worst opinion of us. This is ahimsa, the rest is only ignorance." Bad handwriting "I am now of opinion that children should first be taught the art of drawing before learning how to write. Let the child learn his letters by....
|
|
Introducing Quick Thoughts Thinking about ways to share my tech thoughts and engage with the Internet, I've been feeling frustrated by twitter's tweet length limit and ensuing conversation and clarification struggles. But also the relatively high friction of a blog post has been limiting as well. A new idea I'm going to try is to quickly log "Thoughts of the Week" then edit and curate them into a weekly blog post. I'll be doing this using ....
|
|
A few hours ago I was notified that I have been awarded with the Microsoft MVP Award for Development Technologies. This came totally unexpected. Especially so considering that during the last few years I have been splitting my time between Microsoft and other open source technologies. My public work has mostly been on Python and MongoDB. Yes I also released .NET open source projects in the meantime (more are coming soon) and yes, I wrote ..
|
|
Functors, Applicatives, And Monads In Pictures . Functors, Applicatives, and Monads in Plain English . Tom Ducalf's Programming Fundamentals Talk . What is functional programming? Which programming languages are functional? Why Functional Programming Matters .
|
|
From HBR's 9 Productivity Tips from People Who Write About Productivity : Block time away from reactive tasks (email). Business = wasted energy. Exercise, sleep, and 90 minute work bursts. Incomplete tasks prompt healthy thinking out of context. Time off or stepping back is invaluable. Genuinely help were most successful/enjoyable. Plan for saying no while highlighting priority and seeking feedback. Measure important behavior change. Mak..
|
|
Pancakes 1 teaspoon of salt. 1.5 cups of milk. 2 cups of flour. 2 eggs. 2 tablespoons sugar. 4 tablespoons of melted butter. 6 teaspoons of baking powder. Makes 10/11 pancakes.
|
|
For our last meal of 2015, I contributed dal and rotis. This is my first attempt at making either one of these. Both recipes based on Anupy Singla's Indian for Everyone . Dal Makhani (Buttered black lentils) Roti-Chapati-Phulka
|
|
My year in review - 2015 Github Talks Nov 2015 - Evolution > Revolution – how should microservices be built? Sep 2015 - Elixir + Phoenix Jun 2015 - ZeroMQ in Node.js Apr 2015 - Erlang Ecosystem (PL) Feb 2015 - Elixir Feb 2015 - ClojureScript + Om = ♥ Details: My Talks Meetups Two meet-up groups created and continued in 2015: NodeSchool Silesia Silesian BEAMers Blog Most viewed blog posts by me Books List....
|
|
2015 was an interesting year, and one that I really enjoyed! I spent a lot of time getting/restoring/playing the last few arcade machines that I’ve wanted in my arcade collection - I just love the retro arcade hobby! As a result, I won’t be getting or restoring any more in 2016 at all (I have a few arcades that I want to work on to upgrade, but that’s about it). I’ll be spending most of my time playing them!
|
|
2015 was an interesting year, and one that I really enjoyed! I spent a lot of time getting/restoring/playing the last few arcade machines that I’ve wanted in my arcade collection - I just love the retro arcade hobby! As a result, I won’t be getting or restoring any more in 2016 at all (I have a few arcades that I want to work on to upgrade, but that’s about it). I’ll be spending most of my time playing them!
|
|
I typically use which to figure out the first binary found in $PATH: which -a emacsclient /Users/user/homebrew/bin/emacsclient /usr/bin/emacsclient I always forget about type though: type -a emacsclient emacsclient is /Users/user/homebrew/bin/emacsclient emacsclient is /usr/bin/emacsclient
|
|
Global vs local package installation location {prefix}/lib/node_modules vs path/to/project/node_modules View npm config npm config list ; cli configs user-agent = "npm/2.14.2 node/v4.0.0 darwin x64" ; node bin location = /Users/user/.nvm/versions/node/v4.0.0/bin/node ; cwd = /Users/user/stuff/active/blog ; HOME = /Users/user ; 'npm config ls -l' to show all defaults. Get config value npm config get prefix /Users/user/.nvm/v....
|
Earlier this week, we compared the iPhone and Android in a knockdown showdown of features that matter to us.
|
|
I find during the holiday season many pick up new books , learn a new language , or brush up on some other skill in general. Here’s my contribution to hopefully giving you a few new things to learn about Postgres and ideally utilize in the new year. It’s not in a top 10 list as much as 10 tips and tricks you should be aware of as when you need them they become incredibly handy. But, first a shameless plug if you find any of the following ....
|
|
I find during the holiday season many pick up new books , learn a new language , or brush up on some other skill in general. Here’s my contribution to hopefully giving you a few new things to learn about Postgres and ideally utilize in the new year. It’s not in a top 10 list as much as 10 tips and tricks you should be aware of as when you need them they become incredibly handy. But, first a shameless plug if you find any of the following ....
|
|
A month or so ago I started collection emails on searchcode.com to determine if there was enough interest in a downloadable version of searchcode. The results were overwhelmingly positive. The email list grew far beyond what I would have expected, and this was in the first month. As such I have been working in this downloadable version of searchcode which will probably be called searchcode server. Progress has been reasonably straight for..
|
|
Friday 21:15 Fifteen minutes after the theme announcement, my friend Ben Homan walks through my front door. Not really my front door, I'm just a subletter. But this is a first. Normally he ignores our instructions to walk in without knocking. The first time, he texted me from the driveway. 21:30 Jesse Kooner walks in, also unannounced, bearing frozen pizza. Before he can even kick his shoes off, I loudly explain the theme: a never-b..
|
|
Daniel P. Berrangé wrote about trying out a single node ceph cluster. I decided to take his article and turn it into an Oh-My-Vagrant omv.yaml file. It took me about two minutes to do so, and two hours to debug a problem caused by something I had broken on my laptop. If you’d like to replicate his article in less than 5 minutes, pull down the omv.yaml file that I’ve just published and run omv up. Here’s the full terminal output of my s..
|
|
Daniel P. Berrangé wrote about trying out a single node ceph cluster. I decided to take his article and turn it into an Oh-My-Vagrant omv.yaml file. It took me about two minutes to do so, and two hours to debug a problem caused by something I had broken on my laptop. If you’d like to replicate his article in less than 5 minutes, pull down the omv.yaml file that I’ve just published and run omv up. Here’s the full terminal output of my s..
|
|
Here’s a bit of folklore I often hear (and retell) that’s somewhere between a joke and deep wisdom: if you’re doing a software interview that involves some algorithms problem that seems hard, your best bet is to use hash tables. More succinctly put: Google loves hash tables. As someone with a passion for math and theoretical CS, it’s kind of silly and reductionist. But if you actually work with terabytes of data that can’t fit on a single m..
|
|
Here’s a bit of folklore I often hear (and retell) that’s somewhere between a joke and deep wisdom: if you’re doing a software interview that involves some algorithms problem that seems hard, your best bet is to use hash tables. More succinctly put: Google loves hash tables. As someone with a passion for math and theoretical CS, it’s kind of silly and reductionist. But if you actually work with terabytes of data that can’t fit on a single m..
|
|
Here’s a bit of folklore I often hear (and retell) that’s somewhere between a joke and deep wisdom: if you’re doing a software interview that involves some algorithms problem that seems hard, your best bet is to use hash tables. More succinctly put: Google loves hash tables. As someone with a passion for math and theoretical CS, it’s kind of silly and reductionist. But if you actually work with terabytes of data that can’t fit on a single m..
|
|
Volatile and atomic variables are an important feature in Java language. Especially when dealing with multi threading . A simple incrementation algorithm works fine in a single threaded program, but won’t work as expected in a multi threaded system: private int counter = 0; public int increment(int i) { return i++; } This code will work correctly in a single threaded program, but will give incorrect results in case of a multi threaded ..
|
|
The headline of Postgres 9.5 is undoubtedly: Insert… on conflict do nothing/update or more commonly known as Upsert or Merge. This removes one of the last remaining features which other databases had over Postgres. Sure we’ll take a look at it, but first let’s browse through some of the other features you can look forward to when Postgres 9.5 lands: Grouping sets, cube, rollup Pivoting in Postgres has sort of been possible as has ....
|
|
The headline of Postgres 9.5 is undoubtedly: Insert… on conflict do nothing/update or more commonly known as Upsert or Merge. This removes one of the last remaining features which other databases had over Postgres. Sure we’ll take a look at it, but first let’s browse through some of the other features you can look forward to when Postgres 9.5 lands: Grouping sets, cube, rollup Pivoting in Postgres has sort of been possible as has ....
|