This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* A modification of binary-set-fn.sml to be able to handle set elements | |
* that contain sets. *) | |
(* binary-set-fn.sml | |
* | |
* COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details. | |
* | |
* This code was adapted from Stephen Adams' binary tree implementation | |
* of applicative integer sets. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveFoldable #-} | |
import Data.Foldable | |
import qualified Data.Set as Set | |
import qualified Data.Map as Map | |
class Memo a where | |
memo :: (a -> b) -> (a -> b) | |
memoFix :: ((a -> b) -> (a -> b)) -> (a -> b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def build_rgraph(graph): | |
rgraph = {k: set() for k in graph.keys()} | |
for u in graph.keys(): | |
for v in graph[u]: | |
rgraph[v].add(u) | |
return rgraph | |
def dfs(graph, seen, val, start): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* uses some data structures from | |
* https://github.com/standardml/cmlib/ *) | |
(* also the pretty printer uses some hacked up versions of some stuff | |
* from tom7 that I don't actually include but will if anybody wants to | |
* actually run this *) | |
signature VARIABLE = | |
sig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alaska,1 | |
Delaware,1 | |
Montana,1 | |
NorthDakota,1 | |
SouthDakota,1 | |
Vermont,1 | |
Wyoming,1 | |
Hawaii,2 | |
Idaho,2 | |
Maine,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void reboot(void) | |
{ | |
while (1) { /* keep trying if it doesn't work */ | |
/* wait for the output buffer to be empty */ | |
while (inb(KEYBOARD_CMD_PORT) & KEYBOARD_OUTBUF_FULL_MASK) | |
; | |
/* send the command to have the keyboard controller reboot the machine. | |
* wtf. */ | |
outb(KEYBOARD_CMD_PORT, KEYBOARD_CMD_REBOOT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ --std=c++11 clang-crash.cpp | |
template<typename F> | |
auto foo(F f) -> decltype(f()) { } | |
void bar() { | |
foo([&]() { return *bogus; }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if pgrep unity-settings > /dev/null; then | |
exit | |
fi | |
xsetroot -solid black | |
# sleeps: evade, don't solve, concurrency problems | |
unity-settings-daemon& sleep 1; | |
wmdocker & sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This compiles without error on stable and beta but gives a borrow | |
// error on nightly. It worked as of nightly 6e5a32547. | |
// Replacing the .by_ref() with explicitly taking a &mut ref fixes it. | |
// Other more dubious things fix it also. | |
pub type Session = i32; | |
pub struct StreamParser<'a, T: Iterator<Item=i32>> { | |
_tokens: T, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Michael J. Sullivan (http://www.msully.net/) | |
# Stupid little script to make gnome/unity media keys work when running | |
# weirdo window managers like xmonad and notion. | |
# Directions: | |
# With unity-settings-daemon running, run this script in the background. | |
# Tested on Ubuntu 15.04 using notion. |