Skip to content

Instantly share code, notes, and snippets.

View weeks-grouping.sql
WITH weeks AS (
SELECT distinct date_trunc('week', dates)::date AS start,
daterange(date_trunc('week', dates)::date, (date_trunc('week', dates) + interval '7 days')::date) week
FROM generate_series(date '2013-01-01', now(), '1 day')
dates ORDER BY 1
)
SELECT weeks.start,
count(whatever.*) as count
FROM whatever
JOIN weeks
View screen_cheatsheet.markdown

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>
@brandur
brandur / request-trees.md
Last active Aug 29, 2015
Request Trees
View request-trees.md

But why gen a new id if someone passes you an id? Just use the supplied id in the called srvc.

This is certainly disputable territory, but the main motivation is that depending on service architecture, a single incoming request can balloon out into a full tree of backend requests because requests can map 1:N between any two components. Assigning every request in every component a unique ID allows any particular request to be isolated, while still allowing the any subsection of the tree to be viewed all at once.

Visually, this might look something like this:

      Component 1            Component 2            Component 3
+----------------------+----------------------+----------------------+
View BlockPropagation.md

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@roidrage
roidrage / meatballs.md
Last active Dec 5, 2019
Americanized version of my meatballs recipe
View meatballs.md

The @roidrage meatballs extravaganza.

The secret ingredient to this recipe is letting everything stew for a few hours. First the tomato sauce, requires at least 90 minutes to 2 hours. Then the meatballs in the sauce another 90 minutes. The longer the better.

Once the meatballs are in the sauce, the more time you give them, the more delicious flavor will seep from the meat into the sauce, and vice versa. I'd recommend giving it a total of four hours for maximum taste extraction.

The long stew ensure that the fluids have evaporated and that you're left with the tastiest meatballs you've ever had.

Ingredients (serves four hungry people):

@JoshCheek
JoshCheek / what-is-an-object.txt
Last active Jan 1, 2016
Feynman talking about definitions of objects
View what-is-an-object.txt
Any simple idea is approximate; as an illustration, consider an object,
… what is an object? Philosophers are always saying, “Well, just take a chair for example.”
The moment they say that, you know that they do not know what they are talking about any more.
What is a chair? Well, a chair is a certain thing over there … certain?, how certain?
The atoms are evaporating from it from time to time—not many atoms,
but a few—dirt falls on it and gets dissolved in the paint;
so to define a chair precisely, to say exactly which atoms are chair,
and which atoms are air, or which atoms are dirt,
or which atoms are paint that belongs to the chair is impossible.
So the mass of a chair can be defined only approximately.
@icub3d
icub3d / main.go
Created Jul 29, 2013
First stab at groupcache.
View main.go
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"github.com/golang/groupcache"
"io"
"net"
View adams-heroku-values.md

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@bgentry
bgentry / rated.go
Created Oct 11, 2012
Go token bucket rate limiter #golang
View rated.go
package main
import (
"fmt"
"time"
)
func main() {
ticker := rateLimit(4, 10)
@ryandotsmith
ryandotsmith / instruments.rb
Created Apr 6, 2012
Sequel & Sinatra Instrumentation
View instruments.rb
module Instruments
def self.set_logger(l, m)
@logger = l
@method = m
end
def self.logger
@logger
end