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/bash | |
USAGE="Usage: $(basename "$0" .sh) SOURCE-HG DEST-GIT" | |
SRC=${1?$USAGE} || exit 1 | |
DST=${2?$USAGE} || exit 1 | |
SANITIZE=$(dirname "$0")/sanitize.py | |
(cd "$SRC" && |
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 TupleSections #-} | |
import Control.Arrow (first, second) | |
import Control.Monad (forM_) | |
import Data.List (intersperse, intersect, (\\)) | |
import System.IO (hFlush, stdout) | |
-- Generate the list of possible choices of n items from a list | |
-- Each choice is a pair of the chosen and not-chosen items | |
choices 0 xs = [([], xs)] |
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
W W - - - | |
- - - B B | |
- - - - B | |
W - - - - | |
- - B B - | |
W - - W - | |
W - - - - | |
- - - - B | |
- B - - 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 python | |
import fileinput, re | |
counts = {} | |
for l in fileinput.input(): | |
l = l.lower() | |
for m in re.finditer(r'[a-z](?=[a-z])', l): | |
graph = l[m.start():m.end()+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
// Use the digits 0-9 (once each) to create two numbers by concatenation. (e.g. 152 and 3476980). | |
// What's the highest product you can achieve when these two numbers are multiplied together? | |
using System; | |
using System.Linq; | |
using System.Numerics; | |
using System.Collections.Generic; | |
namespace HighProduct | |
{ |
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
let mergeSort xs = | |
let wrap x = [x] | |
let rec merge = function | |
| x::xs, y::ys -> if x < y then x :: merge (xs, y::ys) else y :: merge (x::xs, ys) | |
| l, [] -> l | |
| [], m -> m | |
let rec mergePairs = function | |
| (l::m::ns) -> merge (l, m) :: mergePairs ns | |
| ls -> ls | |
let rec mergeAll = function |
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
// Display trees of factors of integers | |
// Tree type | |
type 'a Tree = | |
| Branch of 'a * 'a Tree * 'a Tree | |
| Leaf of 'a | |
// Computation of Trees of factors |
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 | |
# This file is sourced by Xsession(5), not executed. | |
# Conditionally restrict the set of applications visible to the user | |
if [ -e ~/.config/restrict-applications.conf -a -n "$XDG_DATA_DIRS" ] | |
then | |
XDG_DATA_DIRS=$(restrict-applications) | |
fi |
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
*.log |
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
#include <cstring> // For strerror | |
#include <list> | |
#include <memory> | |
#include <vector> | |
#include <stdexcept> | |
#include <unistd.h> // For read | |
std::vector<unsigned char> readfile(int fd) | |
{ | |
struct Chunk |
OlderNewer