Skip to content

Instantly share code, notes, and snippets.

View soloman1124's full-sized avatar
🎯
Focusing

Soloman Weng soloman1124

🎯
Focusing
View GitHub Profile
@gabesmed
gabesmed / distance.py
Created February 14, 2012 11:43
great circle distance in python
"""Distance helpers."""
import math
EARTH_CIRCUMFERENCE = 6378137 # earth circumference in meters
def great_circle_distance(latlong_a, latlong_b):
"""
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active December 30, 2025 11:27
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@alairock
alairock / styles.less
Last active October 3, 2019 15:49
Atom.io custom styling.
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@rabbitt
rabbitt / schema_clone.py
Last active October 8, 2020 12:56
PostgreSQL schema cloner (including data).
import psycopg2 as pg
from io import BytesIO
from collections import defaultdict
from contextlib import contextmanager
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED
READ_COMMIT = ISOLATION_LEVEL_READ_COMMITTED
AUTO_COMMIT = ISOLATION_LEVEL_AUTOCOMMIT

#The Winds of Change

Here at Everyday Hero we’re a Ruby shop. We love Ruby. Ruby is great. We are however, starting to experiment with introducing other programming languages and technologies for our backend services into our repertoire. One of our new micro-services has been started in Elixir. In this post I’ll discuss our reasons for looking beyond Ruby at another programming language and technology.

Being a Ruby shop, nearly all our applications are written in Ruby - our oldest apps were started way back on Ruby 1.8 and Rails 1.0, and we now have a fleet of apps that keep up with the latest Ruby and Rails versions, as well as smaller services that use other frameworks like Sinatra or Napa. We have a long history (in Ruby terms) with this technology set. ###Why Ruby is Great I still remember the excitement I felt when I discovered Ruby (and Rails) in about 2006, and I’m pretty sure the reason Ruby gained such popularity is because so many developers felt the same thing. Ruby brought the joy back into prog

@duffn
duffn / creating_a_date_dimension_table_in_postgresql.sql
Last active October 22, 2025 07:38
Creating a date dimension table in PostgreSQL
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@vcastellm
vcastellm / ecs-run
Last active April 15, 2024 17:55
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments: