Skip to content

Instantly share code, notes, and snippets.

View Blaisorblade's full-sized avatar

Paolo G. Giarrusso Blaisorblade

View GitHub Profile
@jwreagor
jwreagor / EmacsKeyBinding.dict
Created March 20, 2014 18:41
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally
@copumpkin
copumpkin / RuntimeTypes.agda
Last active July 24, 2018 19:01
Simulating "type providers" in Agda
module RuntimeTypes where
open import Function
open import Data.Unit
open import Data.Bool
open import Data.Integer
open import Data.String as String
open import Data.Maybe hiding (All)
open import Data.List
open import Data.List.All
@DennisLfromGA
DennisLfromGA / mnt-crouton.conf
Created April 19, 2014 02:30
A Chromebook init script to mount the CROUTON partition - made possible via @drinkcat's crouton/separate_partition branch
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "mount CROUTON on /var/crouton"
author "drinkcat & DennisLfromGA"
start on starting boot-services
task
script
// Quasiquoted excerpt
def cdef = q"""
class $ClassName[..$classTypeParams](..$primaryParams) extends ..$classParents {
..$primaryAccessors
def get = this
def isEmpty = ${quasi.isEmpty}
def copy(..$primaryWithDefaults) = $ObjectName(..$primaryNames)
@andrejbauer
andrejbauer / topology.v
Last active November 28, 2023 19:40
How to get started with point-set topology in Coq. This is not actually how one would do it, but it is an intuitive setup for a classical mathematician.
(* How do to topology in Coq if you are secretly an HOL fan.
We will not use type classes or canonical structures because they
count as "advanced" technology. But we will use notations.
*)
(* We think of subsets as propositional functions.
Thus, if [A] is a type [x : A] and [U] is a subset of [A],
[U x] means "[x] is an element of [U]".
*)
Definition P (A : Type) := A -> Prop.
scala> class Bippy
defined class Bippy
scala> val x = new Bippy
x: Bippy = Bippy@4919b727
scala> show"$x"
<console>:15: error: type mismatch;
found : Bippy
required: psp.std.Shown[_]
@tobym
tobym / mkString
Created September 5, 2014 21:51
Join lines with a given separator by piping a file to this script.
#!/usr/bin/env bash
#
# Usage: cat somefile.txt | mkString [sep]
#
paste -s -d$1 -
@blakecrosby
blakecrosby / gist:1731bcddec0897e1c23d
Created December 24, 2014 16:18
Best Traceroute Ever!
[bcrosby@infiniteloop ~]$ traceroute -m255 xmas.futile.net
traceroute to xmas.futile.net (77.75.106.106), 255 hops max, 60 byte packets
1 router2-nac.linode.com (207.99.1.14) 0.460 ms 0.569 ms 0.693 ms
2 207.99.53.45 (207.99.53.45) 0.243 ms 0.254 ms 0.286 ms
3 0.e1-1.tbr2.tl9.nac.net (209.123.10.78) 1.278 ms 1.260 ms 1.351 ms
4 0.e2-2.pr2.tl9.nac.net (209.123.11.146) 1.252 ms 1.331 ms 1.384 ms
5 xe-0-0-0-0.edge00.thn.uk.hso-group.net (195.66.224.226) 79.858 ms 79.847 ms 79.827 ms
6 xe-8-3.core00.thn.uk.hso-group.net (93.89.91.15) 83.115 ms 80.668 ms 80.683 ms
7 xe-4-4.core00.gs1.uk.hso-group.net (77.75.108.160) 88.337 ms 88.427 ms 86.697 ms
8 ae0-1203.edge00.sov.uk.hso-group.net (46.17.60.117) 82.199 ms 82.166 ms 82.122 ms
#!/bin/sh
#
# e.g. mkString : a b c becomes a:b:c
# A single separator argument means the strings to join are on stdin.
#
# mkString "\n" < /some/file does get the newline
# through the obstacle course.
mkString () {
local sep="$1"
// Define the following traits and companion object
// It's in Rapture Core (https://github.com/propensive/rapture-core) if you don't want to
trait LowPriorityDefaultsTo { implicit def fallback[T, S]: DefaultsTo[T, S] = null }
object DefaultsTo extends LowPriorityDefaultsTo { implicit def defaultDefaultsTo[T]: DefaultsTo[T, T] = null }
trait DefaultsTo[T, S]
// Then, assuming we want to specify a default for a type class like `Namer`,
case class Namer[T](name: String)