Skip to content

Instantly share code, notes, and snippets.

Reading SBT Credentials from OS X Keychain

In the following, replace the REPO_NAME value with the natural-language name of your repository, replace REPOSITORY with the domain name (e.g. repo1.maven.org) and replace USERNAME with your repository user.

credentials += {
  val Password = """.*password: "([^"]+)".*""".r
  var lines: String = ""
  val logger = new ProcessLogger {
 def info(s: => String) = {}

This Gist contains the script and generated output file for an Acer B276HUL.

The pre-generated file below is known to work with:

  • OS X Mavericks
  • OS X Yosemite
  • OS X El Capitan

For El Capitan:

  1. Restart your Mac while holding Command-R: this puts your Mac into Recovery Mode.
@viktorklang
viktorklang / SerializedExecutionContext.scala
Created January 17, 2013 00:32
Wraps an ExecutionContext into a new ExecutionContext which will execute its tasks in sequence, always.
import java.util.concurrent.ConcurrentLinkedQueue
import java.util.concurrent.atomic.AtomicInteger
import scala.concurrent.ExecutionContext
import scala.util.control.NonFatal
import scala.annotation.tailrec
object SerializedExecutionContext {
def apply(batchSize: Int)(implicit context: ExecutionContext): ExecutionContext = {
require(batchSize > 0, s"SerializedExecutionContext.batchSize must be greater than 0 but was $batchSize")
new ConcurrentLinkedQueue[Runnable] with Runnable with ExecutionContext {
private final val on = new AtomicInteger(0)
@jasonrudolph
jasonrudolph / 00-about.md
Created September 21, 2012 18:42
Rough Notes from Strange Loop 2012
@casualjim
casualjim / actor_specification.scala
Created November 30, 2011 13:42
Specs2 with Akka and jodatime support
trait ActorSpecification extends BaseSpecification
with ArgumentsArgs
with ArgumentsShortcuts
with MustThrownMatchers
with ShouldThrownMatchers
with FormattingFragments
with StandardResults
with StandardMatchResults
with PendingUntilFixed
with TimeHelpers
@viktorklang
viktorklang / ScalaEnum.scala
Created June 30, 2011 23:12
DIY Scala Enums (with optional exhaustiveness checking)
trait Enum { //DIY enum type
import java.util.concurrent.atomic.AtomicReference //Concurrency paranoia
type EnumVal <: Value //This is a type that needs to be found in the implementing class
private val _values = new AtomicReference(Vector[EnumVal]()) //Stores our enum values
//Adds an EnumVal to our storage, uses CCAS to make sure it's thread safe, returns the ordinal
private final def addEnumVal(newVal: EnumVal): Int = { import _values.{get, compareAndSet => CAS}
val oldVec = get
@bwmcadams
bwmcadams / org.mongodb.mongod.plist
Created March 2, 2011 23:59
Suggested Plist for Mac MongoDB 1.8+, enables durability and clean shutdown
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.mongodb.mongod</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mongodb/bin/mongod</string>
<string>run</string>
@eltimn
eltimn / PasswordField
Created February 8, 2011 13:33
Lift-Record Password Field
import java.util.regex._
import scala.xml._
import org.mindrot.jbcrypt.BCrypt
import net.liftweb._
import common._
import http.S
import http.js._
import json.JsonAST.{JNothing, JNull, JString, JValue}
@buka
buka / fboauthakka.scala
Created December 30, 2010 05:28
Connecting Facebook OAuth with Akka REST...
/**
* Garrick Evans
* 29 Dec 2010
*/
import akka.http._
import akka.actor._
import net.smartam.leeloo.client._
import net.smartam.leeloo.client.request.OAuthClientRequest
import net.smartam.leeloo.client.response. {OAuthAuthzResponse, GitHubTokenResponse}
@ghostm
ghostm / MongoProtoUser.scala
Created November 11, 2010 05:53
MetaMegaProtoUser that uses Mongo
/*
Copyright 2012 Matthew Henderson
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
Unless required by applicable law or agreed to in writing, software