Skip to content

Instantly share code, notes, and snippets.

View Blaisorblade's full-sized avatar

Paolo G. Giarrusso Blaisorblade

View GitHub Profile
#!/usr/bin/env bash
#
# Given a scalac command line which produces a stack trace, such as
# <this program> some-scalac crasher.scala
# Tracks down a scala git repository if it can; parses the stack trace
# for files and line numbers; and outputs -3 lines to +3 lines for
# each line in the stack trace, as the file was at the time of the commit.
MaxFrames=10
@DennisLfromGA
DennisLfromGA / crouton.conf
Last active July 17, 2020 17:27
A ChromeOS upstart script to kick-off a crouton chroot desktop environment.
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
## Filename: /etc/init/crouton.conf
## NOTE: 'rootfs' verification needs to be removed.
## crouton chroot - Start session
##
## This will start a (crouton) chroot Desktop Environment session
@DennisLfromGA
DennisLfromGA / rw-rootfs
Last active November 5, 2024 22:02
A script that asks to make the root filesystem read-writable for subsequent changes and additions by the user.
#!/bin/sh -e
##!! PLEASE USE THIS SCRIPT WITH CAUTION - AND AT YOUR OWN RISK !!##
##!! IT HAS BEEN KNOWN TO CAUSE RESETS AND WIPE DATA ON SOME CHROMEBOXES !!##
APPLICATION="${0##*/}"
ANSWER=''
SUDO=''
USAGE="
$APPLICATION [no options]
@tibbe
tibbe / ghc-clang-wrapper
Last active January 3, 2016 10:19 — forked from mzero/ghc-clang-wrapper
Strip -nodefaultlibs flag to avoid warning This removes this warning: clang: warning: argument unused during compilation: '-nodefaultlibs'
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
anonymous
anonymous / emacs.memory.leak.aka.distnoted.patch.diff
Created January 22, 2014 03:45
This is a patch (with commentary) that fixes a memory leak in 24.3 for OSX Mavericks (10.9) users who experience excessive resource consumption by distnoted.
From 8ab91751069e391a95151c6716a546b1732ade92 Mon Sep 17 00:00:00 2001
From: JP <twitter:canoeberry>
Date: Sun, 19 Jan 2014 11:58:54 +0000
Subject: [PATCH] partial memleak fix
This patch was created by JP (twitter: @canoeberry) based on a memleak fix by Dirk (emacs committer) below:
https://github.com/mirrors/emacs/commit/57ae6509a3b6a274f89b9caea0284c6156470625
This memory leak is fixed in the trunk as of now and will be in the next official release: 24.4.

Hi, looking for scalac flags?

This gist has been upgraded to a blog post here.

@paulp
paulp / nbang.scala
Last active August 29, 2015 13:56
object Nats {
sealed trait Nat {
type Prev <: Nat { type Succ = Nat.this.type }
type Succ <: Nat { type Prev = Nat.this.type }
}
object Zero extends Nat
type _0 = Zero.type
type _1 = _0#Succ
type _2 = _1#Succ
@puffnfresh
puffnfresh / agda-copatterns.md
Last active December 11, 2016 06:20
Agda copatterns (Release notes for Agda 2 version 2.3.4)

Experimental feature: copatterns. (Activated with option --copatterns)

We can now define a record by explaining what happens if you project the record. For instance:

{-# OPTIONS --copatterns #-}

record _×_ (A B : Set) : Set where
 constructor _,_
@puffnfresh
puffnfresh / Tagged.scala
Created March 5, 2014 21:51
Another form of unboxed tagged types.
import language.higherKinds
object Tagged {
type @@[A, B] = { type T = A }
type Id[A] = A
implicit class Taggable[A](a: A) {
def tagged[B]: A @@ B = a.asInstanceOf[A @@ B]
}
@zsup
zsup / ddd.md
Last active April 2, 2025 23:33
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.