Skip to content

Instantly share code, notes, and snippets.

Jōshin Steven Dee mrdomino

Block or report user

Report or block mrdomino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View quine.hs
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 = "
mrdomino / valenquine.hs
Last active Dec 13, 2015
It’s a quine, almost.
View valenquine.hs
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)
#!/usr/bin/env python
Example demonstrating O(1)-space iteration over binary trees.
class Node(object):
A binary tree node with left-child, right-child, and parent pointers.
View nonascii.c
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
static void
usage(const char* argv0)
"Usage: %s\n"
" Passes spans of non-ASCII characters from stdin to stdout, "
mrdomino /
Last active Mar 25, 2017
Passphrase generator
#!/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.
View run-synergy
function getpass {
cat "$SYNERGY_DIR/pass" | tr -d '\n' | md5sum | cut -d' ' -f1
mrdomino /
Last active Aug 29, 2015
Registry sketch
#include <iomanip>
#include <iostream>
#include <utility>
#include "registry.h"
using std::cerr;
using std::cin;
using std::endl;
using std::ios_base;
View fib.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
uint64_t* fibs;
size_t fib_len;
expand_fibs(uint64_t x)
View elias_unary.c
#include <hammer/glue.h>
#include <hammer/hammer.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
HParser* parser;
HBenchmarkResults* results;
View resetter.h
#include <utility>
template <typename T, typename U = T>
class ScopedRestore {
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_);
You can’t perform that action at this time.