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
e '\\' = "\\\\" | |
e '\n' = "\\n" | |
e '\"' = "\\\"" | |
e x = [x] | |
q = concatMap e | |
m s = s ++ "\"" ++ q s ++ "\"" | |
main = putStrLn $ m s | |
where s = "e '\\\\' = \"\\\\\\\\\"\ne '\\n' = \"\\\\n\"\ne '\\\"' = \"\\\\\\\"\"\ne x = [x]\nq = concatMap e\nm s = s ++ \"\\\"\" ++ q s ++ \"\\\"\"\nmain = putStrLn $ m s\n where s = " |
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
t [] = [] | |
t (c:[]) = [] | |
t (c:cs) = c:t cs | |
g s = s ++ " and growing." | |
main = do | |
putStr s | |
print s | |
putStrLn $"m = (g.t)\n\n\n\n " ++ show m | |
s = "t [] = []\nt (c:[]) = []\nt (c:cs) = c:t cs\ng s = s ++ \" and growing.\"\nmain = do\n putStr s\n print s\n putStrLn $\"m = (g.t)\\n\\n\\n\\n \" ++ show m\ns = " | |
m = (g.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 python | |
""" | |
Example demonstrating O(1)-space iteration over binary trees. | |
""" | |
import weakref | |
class Node: | |
""" | |
A binary tree node with left-child, right-child, and parent pointers. |
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 <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
static void | |
usage(const char* argv0) | |
{ | |
fprintf(stderr, | |
"Usage: %s\n" | |
" Passes spans of non-ASCII characters from stdin to stdout, " |
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 | |
""" | |
Generates random memorable passphrases. | |
This script builds a set of unique suitable words from a dictionary file, then | |
produces one or more passphrases chosen at random form that set. It also | |
optionally prints estimates of the entropy (i.e. difficulty to guess) of the | |
produced passphrases based on the number of items in the set and the number of | |
words per phrase. |
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 | |
SERVER=stevens-mac-mini.local | |
SYNERGY_DIR="$HOME/.config/synergy" | |
function getpass { | |
cat "$SYNERGY_DIR/pass" | tr -d '\n' | md5sum | cut -d' ' -f1 | |
} |
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 <iomanip> | |
#include <iostream> | |
#include <utility> | |
#include "registry.h" | |
using std::cerr; | |
using std::cin; | |
using std::endl; | |
using std::ios_base; |
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 <inttypes.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
uint64_t* fibs; | |
size_t fib_len; | |
int | |
expand_fibs(uint64_t x) |
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 <hammer/glue.h> | |
#include <hammer/hammer.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
HParser* parser; | |
HBenchmarkResults* results; |
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 <utility> | |
template <typename T, typename U = T> | |
class ScopedRestore { | |
public: | |
explicit ScopedRestore(T* it): | |
ref_(*it), old_val_(*it) {} | |
~ScopedRestore() noexcept(noexcept(this->ref_ = std::move(this->old_val_))) { | |
using std::move; | |
ref_ = move(old_val_); |
OlderNewer