Skip to content

Instantly share code, notes, and snippets.

View ed-flanagan's full-sized avatar
🚲
Hopefully outside

Ed Flanagan ed-flanagan

🚲
Hopefully outside
View GitHub Profile
@ed-flanagan
ed-flanagan / geo_distance.js
Created July 29, 2015 10:40
Great-circle distance formulas in JavaScript
var earth_radius_km = 6371.0;
function deg_to_rad(deg) {
return (deg * Math.PI / 180.0);
}
function haversine_distance(latitude1, longitude1, latitude2, longitude2) {
var lat1 = deg_to_rad(latitude1);
var lng1 = deg_to_rad(longitude1);
var lat2 = deg_to_rad(latitude2);
<?php
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
$earth_radius_km = 6371;
@ed-flanagan
ed-flanagan / geo_distance.cpp
Last active May 22, 2020 13:24
Great-circle distance computational forumlas in C++
/*
* Great-circle distance computational forumlas
*
* https://en.wikipedia.org/wiki/Great-circle_distance
*/
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>
\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}
\pagestyle{empty}
\newenvironment{blockquote}{
@ed-flanagan
ed-flanagan / install_Spotify.md
Last active December 26, 2017 10:56
Install Spotify Preview on Debian 8 Jessie

Install Spotify Preview on Debian 8 Jessie

Note: Possibly outdated

Note: This is more of a personal reference. You should never install/add keys/libs/programs you yourself don't trust or know are safe.

Check https://www.spotify.com/us/download/linux/ for the official scoop.

Intial Aptitude Install

  1. Add the Spotify repository signing key to be able to verify downloaded packages
@ed-flanagan
ed-flanagan / install_R.md
Last active August 29, 2015 14:19
Install R from source

Install R from source

Why not use the Aptitude package manager?

Because I find myself having to install R all the time without sudo and on systems where I can't install packages from apt-get.

So this is my "comprehensive" install script so I can pick and choose which things I need to copy-pasta to install R.

@ed-flanagan
ed-flanagan / res_fix.md
Last active January 28, 2018 16:50
Debian Jessie Mate Resolution Fix for an AMD Radeon Card

Debian Jessie Mate Resolution Fix for an AMD Radeon Card

Note: possibly outdated

How-To

  1. Open /etc/apt/sources.list with your favorite text editor
  2. Change your deb sources so it looks something like this: deb http://http.us.debian.org/debian/ jessie main contrib non-free
    1. The important part is jessie...non-free
  3. Run:
@ed-flanagan
ed-flanagan / getter.sh
Created February 22, 2015 20:55
Simple wget with flags (just for reference)
#!/usr/bin/env bash
# -w 1
wget \
--page-requisites \
-r \
--convert-links \
--no-clobber \
-l inf \
@ed-flanagan
ed-flanagan / Popcorn-Time.desktop
Last active October 31, 2020 10:10
Gnome Popcorn Time application launcher
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Popcorn Time
Name[en_US]=Popcorn Time
GenericName=BitTorrent Stream Player
GenericName[en_US]=BitTorrent Stream Player
Comment=Run the Popcorn Time application
Comment[en_US]=Run the Popcorn Time application
Type=Application
@ed-flanagan
ed-flanagan / largest_perfect_square.c
Last active August 29, 2015 14:04
Print the largest perfect square within given range
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
if (argc < 2) {
printf("usage: %s <limit>\n", argv[0]);
return 1;
}