-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: "Interesting things I've learned: Nov 2024" | ||
slug: "interesting-things-i-learned-nov-2024" | ||
date: "2024-11-09" | ||
published: false | ||
tags: | ||
- TIL | ||
- Postgres | ||
- SQL | ||
- LLMs | ||
description: "This article contains a collection of interesting things I've learned while working on my projects." | ||
--- | ||
|
||
## The FILTER clause in SQL | ||
( H/T [@winand.at](https://bsky.app/profile/winand.at/post/3lagizjuo4e2y)) | ||
|
||
```sql | ||
SELECT | ||
count(*) as user_count, | ||
count(*) filter (where age > 18) as adult_user_count | ||
FROM users; | ||
``` | ||
|
||
is the equivalent of: | ||
|
||
```sql | ||
SELECT | ||
count(*) as user_count, | ||
sum(case when age > 18 then 1 else 0 end) as adult_user_count | ||
FROM users; | ||
``` | ||
|
||
except that you don't need to write a complicated `case` expression. | ||
|
||
## Cloudflare free-tier limit | ||
|
||
There is a 100,000-request daily limit on the free tier of Cloudflare Workers + Pages. | ||
|
||
I learned this the hard way, thanks to a recent article making it to #2 on [Hacker News](https://news.ycombinator.com/item?id=42057431), and getting about 108,000 page views in a day. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: "The smallest ungoogleable number" | ||
slug: "smallest-ungoogleable-number" | ||
date: "2024-11-06" | ||
published: false | ||
tags: | ||
- Maths | ||
description: "What is the smallest number that doesn't return any Google result?" | ||
--- | ||
|
||
You can Google search for numbers. | ||
|
||
Some of the larger ones will return no results. | ||
|
||
The question is: what is the smallest number that doesn't return any Google result? | ||
|
||
## Ground rules | ||
|
||
First we need to establish some ground rules. | ||
|
||
1. We will only consider *positive* numbers. [1] | ||
2. We will only consider *integers* (not floating point numbers). | ||
3. We will only consider numbers written in arabic numerals. So no English words, no Roman numerals, etc. | ||
|
||
## Is there a smallest ungoogleable number? | ||
|
||
**Yes, and there always will be.** | ||
|
||
There is an infinite number of integers, but only a finite number of bits encodable on the Internet [2]. | ||
The [Pigeonhole principle](https://en.wikipedia.org/wiki/Pigeonhole_principle) will show that there will always be a number that isn't encoded on the Internet, and thus will not be Googleable. | ||
|
||
## So what is the smallest ungoogleable number? | ||
<insert number here> | ||
|
||
This is true as of <insert date here>. This will likely cease to be the smallest ungoogleable number once this post gets picked up by Google, and appears as a result. | ||
|
||
Unless I continually update this post, but who's got time for that? 🤔 | ||
|
||
|
||
[1] If we allow negative numbers, we can flip the question and ask "what is the smallest Googleable number?". But this is my blog, and I get to make the rules. | ||
[2] The number of bits encodable by the Internet is a massive number, and is one that is - at this point in history - growing over time, but it is still finite. It will be limited by the [number of bits in the observable universe](https://physics.stackexchange.com/questions/35920/maximum-possible-information-in-the-universe). |