Skip to content

Instantly share code, notes, and snippets.

@dcluna
dcluna / gist:cbc492ee1bbea7931a02cbb37f2ed510
Created October 17, 2024 16:48 — forked from jackrusher/gist:5139396
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)
@dcluna
dcluna / README.md
Created June 21, 2024 14:08 — forked from Restuta/README.md
How to get IP Ranges for Heroku

Ip Ranges

Sometimes it's useful to know what IP ranges our servers are operating in. Since we run on Heroku, it's a little complicated. However, Heroku runs on AWS, which has this page dedicated to IP Ranges by Region.

Heroku recommends using this to identify which region are bing in use. If dynos are run in common spaces in US region, we can look up information about this region using Heroku's API:

using httpie:

 http https://api.heroku.com/regions/us "Accept:application/vnd.heroku+json; version=3"
@dcluna
dcluna / Caddyfile
Created May 4, 2023 22:52 — forked from argami/Caddyfile
Execute HTTPS Local development in 2 Steps
https:// {
log
tls internal {
on_demand
}
reverse_proxy :3000
}
@dcluna
dcluna / country-bounding-boxes.py
Created November 18, 2020 18:57 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@dcluna
dcluna / web-servers.md
Created July 16, 2020 17:37 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dcluna
dcluna / setup-notes.md
Created May 28, 2020 13:40 — forked from eddies/setup-notes.md
Spark 2.0.0 and Hadoop 2.7 with s3a setup

Standalone Spark 2.0.0 with s3

###Tested with:

  • Spark 2.0.0 pre-built for Hadoop 2.7
  • Mac OS X 10.11
  • Python 3.5.2

Goal

Use s3 within pyspark with minimal hassle.

@dcluna
dcluna / vpn.md
Created September 6, 2019 16:57 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?

@dcluna
dcluna / left_join_arel_example.rb
Created January 4, 2019 18:57 — forked from mildmojo/left_join_arel_example.rb
LEFT JOIN in ARel for ActiveRecord in Ruby on Rails
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of
# the mechanics, not a real-world use case.
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord
# extension that works for any named association. That's what I really wanted!
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446
# == DEFINITIONS
# - A Taxi is a car for hire. A taxi has_many :passengers.
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi.
"use strict";
import * as Promise from "bluebird";
import createDeal from "../../deal/operations/create";
import stopEmails from "./stop-lease-end-emails";
import { createActivity, setCurrentApplication } from "./create";
import { emitApplicationCreated } from "../events/emitter";
import { models, withTransaction } from "../../models";
import {
@dcluna
dcluna / keybase.md
Created May 21, 2017 22:05
keybase.md

Keybase proof

I hereby claim:

  • I am dcluna on github.
  • I am dcluna (https://keybase.io/dcluna) on keybase.
  • I have a public key whose fingerprint is CC16 9770 FA56 0DB7 C6F7 2FED 9050 76FA D072 46D5

To claim this, I am signing this object: