Skip to content

Instantly share code, notes, and snippets.

View grkuntzmd's full-sized avatar

G. Ralph Kuntz, MD grkuntzmd

  • Gainesville, Florida
View GitHub Profile
package main
import (
"strings"
"path/filepath"
)
func fileNameWithoutExtension(fileName string) string {
return strings.TrimSuffix(fileName, filepath.Ext(fileName))
}
@grkuntzmd
grkuntzmd / Haskell-debug-trace
Last active August 29, 2015 14:02
Haskell debug #haskell #debug
import Debug.Trace
debug :: Show a => String -> a -> a
debug description value =
trace (description ++ ": " ++ show value) value
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()

Debian on ThinkPad W540

This is a short write-up of my experiences with installing Debian on a ThinkPad W540.

All commands should be run as root, unless indicated otherwise.

Table of Contents

Debian Install Notes

@jnape
jnape / FutureEither.scala
Created April 3, 2013 09:03
Making dealing with Future[Either[L, R]] palatable in Scala
package com.thoughtworks.futureeither
import concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import concurrent.duration.FiniteDuration
import java.util.concurrent.TimeUnit
class FutureEither[L, R](private val future: Future[Either[L, R]]) {
def flatMap[R2](block: R => FutureEither[L, R2]): FutureEither[L, R2] = {