Skip to content

Instantly share code, notes, and snippets.

View tlockney's full-sized avatar

Thomas Lockney tlockney

View GitHub Profile
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto
@non
non / sipzz.md
Last active August 6, 2017 04:24

SIP-ZZ - NewType Classes

Introduction

This is a proposal to introduce syntax for classes in Scala that can get completely inlined, so operations on these classes have zero overhead compared to external methods. Some use cases for inlined classes are:

  • Inlined implicit wrappers. Methods on those wrappers would be

How to GPG as a Scala OSS Maintainer

tl;dr Generate a GPG key pair (exercising appropriate paranoia). Send it to key servers. Create a Keybase account with the public part of that key. Use your keypair to sign git tags and SBT artifacts.

GPG is probably one of the least understood day-to-day pieces of software in the modern developer's toolshed. It's certainly the least understood of the important pieces of software (literally no one cares that you can't remember grep's regex variant), and this is a testament to the mightily terrible user interface it exposes to its otherwise extremely simple functionality. It's almost like cryptographers think that part of the security comes from the fact that bad guys can't figure it out any more than the good guys can.

Anyway, GPG is important for open source in particular because of one specific feature of public/private key cryptography: signing. Any published software should be signed by the developer (or company) who published it. Ideally, consu

@stupidpupil
stupidpupil / GalliumOS on Edgar.markdown
Last active April 19, 2024 17:09
Guide to installing GalliumOS on an Acer Chromebook 14" (CB3-431) 'Edgar'

GalliumOS on Edgar

This document sets out how I installed GalliumOS 2.1 on a new Acer Chromebook 14" (CB3-431) 'Edgar' in April 2017. I installed GalliumOS on the internal eMMC storage, but left Chrome OS in place (allowing dual-booting).

It is meant to be an easy-to-follow and particularly thorough (if repetitive) guide, but I make no warranty that it will work correctly for you. It will wipe all data on your Edgar.

I have tried to provide references for each section; see the GalliumOS wiki guide to chrx installation for an overview of the general process.

⚠ Caution: There have been reports of Edgars' speakers overheating, due to a malfunction of the audio hardware, when booted into anything other than Chrome OS. I have not experienced this, and it seems to be believed that this will not now occur under GalliumOS. More information can be found in the comments for the [GalliumOS Braswell Platform Validation

@tlockney
tlockney / reading.md
Last active March 29, 2017 03:47
How I read so much

I've been asked by a few colleagues how I manage to read so much, so I thought I'd just write this up once so I can link to it later. :~)

First, here are a few articles that touch on some of the keys to how I read so much and how I make sure I remember the important bits:

I can’t say I follow these exact principles – among other things, I’m definitely less diligent about some of my reading than what they outline. But that’s a conscious choice in many (but not all) cases.

@benbriggs
benbriggs / .slate.js
Last active July 29, 2021 23:45
JS slate file
slate.config('orderScreensLeftToRight', true);
const SCREENS = {
leftScreen: 0,
middleScreen: 1,
rightScreen: 2,
};
const WINDOW_ORIGINS = {
leftHalf: {
@adriaanm
adriaanm / nightly.sbt
Created December 11, 2016 19:13
How to use the latest Scala nightly build from your sbt build by @SethTisue
// originally by @SethTisue, see http://stackoverflow.com/questions/40622878/how-do-i-tell-sbt-to-use-a-nightly-build-of-scala-2-11-or-2-12/40622879#40622879
resolvers += "nightlies" at "https://scala-ci.typesafe.com/artifactory/scala-release-temp/"
scalaVersion := {
val propsUrl = new URL("https://scala-ci.typesafe.com/job/scala-2.12.x-integrate-bootstrap/lastSuccessfulBuild/artifact/jenkins.properties/*view*/")
val props = new java.util.Properties
props.load(propsUrl.openStream)
props.getProperty("version")
}
scalaBinaryVersion := "2.12"
package demo
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.{Global, Phase}
import scala.tools.nsc.plugins.{Plugin, PluginComponent}
class DemoPlugin(val global: Global) extends Plugin {
import global._
override def init(options: List[String], error: String => Unit): Boolean = true
@bmc
bmc / StaticFile.scala
Last active September 3, 2021 20:08
I needed code to serve static files from an Akka HTTP server. I wanted to use fs2 to read the static file. Michael Pilquist recommended using streamz to convert from an fs2 Task to an Akka Source. This is what I came up with. (It does actually work.)
object StaticFile {
// Various necessary imports. Notes:
//
// 1. fs2 is necessary. See https://github.com/functional-streams-for-scala/fs2
// 2. streamz is necessary. See https://github.com/krasserm/streamz
// 3. Apache Tika is used to infer MIME types from file names, because it's more reliable and
// fully-featured than using java.nio.file.Files.probeContentType().
//
// If using SBT, you'll want these library dependencies and resolvers: