Skip to content

Instantly share code, notes, and snippets.

@akkie
akkie / Math.scala
Created October 14, 2015 10:27
Best rational approximation
import scala.annotation.tailrec
object Math {
/**
* Calculates the `Best rational approximation` based on the Farey sequence.
*
* Translated from John D. Cook's Python implementation and David Weber's C++ modification.
*
* @see http://www.johndcook.com/blog/2010/10/20/best-rational-approximation/
import java.net.InetSocketAddress
import com.typesafe.sbt.packager.Keys._
import play.sbt.PlayImport.PlayKeys._
import play.sbt.{ Play, PlayRunHook }
import sbt.Keys._
import sbt._
/**
* NPM plugin.
@akkie
akkie / .hyper.js
Last active September 23, 2021 09:49
hyper.js with Msys2 configuration
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Hack, Consolas, monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@akkie
akkie / gist:c6759b32ebec079583b73edae879bfc3
Last active March 26, 2019 18:37
Install ansible on msys2
pacman -S python2 python2-setuptools libffi-devel openssh openssl openssl-devel gcc
easy_install-2.7 pip
# To get `pycrypto` compiled, we must comment out the line:
# #define __BSD_VISIBLE 1
# in /usr/include/python2.7/pyconfig.h
#
# Otherwise it won't compile!!!
# See: http://cygwin.1069669.n5.nabble.com/python-2-7-12-pip-install-with-extensions-fails-with-warning-quot-BSD-VISIBLE-quot-redefined-td131045.html#a131120
/**
* Licensed to the Minutemen Group under one or more contributor license
* agreements. See the COPYRIGHT file distributed with this work for
* additional information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0