Skip to content

Instantly share code, notes, and snippets.

@dideler
dideler / compgeo.md
Created March 5, 2012 20:20
Computation Geometry

Computational Geometry

(Abridged notes from Introduction to Algorithms)

Branch of CS that studies algorithms for solving geometric problems. Input is typically a set of points, a set of line segments, or the vertices of a polygon in counterclockwise order. Output is often a response to a query about the objects, such as whether any lines intersect, or finding a new geometric object (e.g. convex hull) of the set of points.

We look at computational-geometry algorithms in two dimensions (2D), i.e. in the plane. Each object is represented by a set of points {P1, P2, P3, ...}, where each Pi = (Xi, Yi). For example, an n-vertex polygon _P = _.

@dideler
dideler / bootstrapping.md
Last active March 5, 2026 02:30
Bootstrapping - a list of useful resources to get up and running quickly

Welcome!

UPDATE: This list is no longer maintained. I've moved it to its own repo so you can send suggestions as Pull Requests. https://github.com/dideler/bootstrapping/

For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.

Starring this gist will give me an idea of how many people consider this list useful.

@dideler
dideler / bot.rb
Last active February 4, 2026 23:07
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@dideler
dideler / 0-startup-overview.md
Last active January 17, 2026 09:45
Startup Engineering notes
@dideler
dideler / vcr_rewinder.rb
Last active November 27, 2025 04:29
Show unused VCR cassettes. Use with vcr gem: https://github.com/vcr/vcr
# Require this file in spec_helper.rb to show which cassettes are not being used
# after the test suite has run. Then you can decide if you want to delete them.
require 'vcr'
require 'set'
USED_CASSETTES = Set.new
module CassetteReporter
def insert_cassette(name, options = {})
USED_CASSETTES << VCR::Cassette.new(name, options).file
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active November 23, 2025 10:07
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@dideler
dideler / code_review_checklists.md
Last active September 29, 2025 12:57
Code review checklists. Leave your suggestions in a comment below!

Based on the article: Using checklists for code review

In general, people are pretty good at the code review process, but it's sometimes surprising what can slip through. A natural consequence of the way our brains look at the world is that it's easy to pay a lot of attention to small details and code style flubs, and completely miss the big picture.

Obviously, not everything is applicable for every change. If the review request isn't making any changes to UI, then skip the first two checklists entirely. If a change is a bug fix, typically don't review it for architecture and design principles.

Put the big stuff first (e.g. architecture). You don't want to work through a ton of small issues before realizing that everything has to be rewritten.

Do a pass through the code for each and every item in the checklist. By only looking for a very specific type of defect, each pass goes relatively quickly, even for large changes. Focu

@dideler
dideler / quotes.md
Last active September 29, 2025 12:57
Favourite Quotations (in no particular order)

If you spend the next twenty years of your life, you could do something like a Michael Angelo painting, would it be worth it? Of course it would. It would be worth it for that one thing. For things to be worthwhile, they should be difficult.

  • Joe Armstrong

For every power user that writes in asking for a feature, there’s one new user (and ten potential users) that felt the opposite way.

  • Ben Balter

When you’re evaluating potential features, part of your role is to be an advocate for the long tail of users that won’t yet advocate for themselves.

@dideler
dideler / apple.md
Last active September 29, 2025 12:57
Great job postings. Highlighting ideal qualities of a developer.

You can move quickly through various full-stack troubleshooting tasks in our mission-critical distributed system; You are highly motivated to create extremely reliable, secure and performant pieces of software and processes; You are constructive and you take feedback well, incorporating it in your day-to-day tasks; Your communication skills are stellar, even when operating under stress; You don’t just hack something together; You craft incredibly polished pieces of code; Test driven development comes naturally to you; Reducing your code coverage is not an option for you; You have astonishing tracking skills; Your bugs are always up-to-date and your projects are delivered on time.

From a RoR job posting by Apple Inc.

@dideler
dideler / bitwise-operators.md
Created April 12, 2012 08:25
Bitwise tricks

Inspired by this article. Neat tricks for speeding up integer computations.

Note: cin.sync_with_stdio(false); disables synchronous IO and gives you a performance boost. If used, you should only use cin for reading input (don't use both cin and scanf when sync is disabled, for example) or you will get unexpected results.

Multiply by a power of 2

x = x << 1; // x = x * 2