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 UnicodeSyntax, ViewPatterns #-} | |
-- usage: | |
-- persistent-graph < config/models > schema.dot | |
-- neato schema.dot -Tpdf > schema.pdfimport Database.Persist.Base (EntityDef(..), ColumnDef(..)) | |
import Database.Persist.Quasi (parse) | |
import Data.List (intersperse) | |
main = do |
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 UnicodeSyntax #-} | |
module Log where | |
import Network.Wai | |
import Network.HTTP.Types | |
import System.Log.Logger | |
import qualified Data.ByteString.Char8 as C | |
import Control.Monad.Trans |
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
import Database.Persist.Store | |
import Database.Persist.EntityDef | |
import qualified Database.Persist.GenericSql as GenSql | |
import Language.Haskell.TH | |
import Language.Haskell.TH.Quote | |
import Language.Haskell.Meta | |
import qualified Data.Text as T | |
-- example: | |
-- (fmap unSingle . listToMaybe → mcssid) ← runDB $ |
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 <stdio.h> | |
union zig { | |
int num; | |
char *str; | |
}; | |
enum pop { BAR, QUX }; | |
void foo_ (enum pop p, union zig z){ |
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
struct t{struct t*l,*r;int x;}; | |
extern puts(); | |
int main(){ | |
struct t tree1 = { 0, 0, 1 }; | |
struct t tree3 = { 0, 0, 3 }; | |
struct t tree2 = { &tree1, &tree3, 2 }; | |
struct t tree5 = { 0, 0, 5 }; | |
struct t tree7 = { 0, 0, 7 }; |
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
set -e | |
set -u | |
main () { | |
init | |
# ... | |
} | |
# contains <haystack> <needle> | |
# Test if the space-separated list haystack contains needle |
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
-- Code generation with types | |
-- For GHC HEAD (7.7.20131005) | |
{-# LANGUAGE | |
KindSignatures, DataKinds, PolyKinds, UnicodeSyntax, | |
TypeFamilies, UndecidableInstances, TypeOperators, | |
ScopedTypeVariables, ConstraintKinds, FlexibleInstances, | |
MultiParamTypeClasses, FunctionalDependencies, | |
FlexibleContexts, RankNTypes, ImpredicativeTypes, |
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
diff --git a/src/clustering/administration/cli/admin_command_parser.cc b/src/clustering/administration/cli/admin_command_parser.cc | |
index 453eb0d..4d0d260 100644 | |
--- a/src/clustering/administration/cli/admin_command_parser.cc | |
+++ b/src/clustering/administration/cli/admin_command_parser.cc | |
@@ -344,7 +344,8 @@ admin_command_parser_t::admin_term_cap_t::admin_term_cap_t(fd_t fd) { | |
} | |
// Command to disable all formatting | |
- char *normal_cstr = tgetstr("me", NULL); | |
+ char end_modes[] = "me"; |
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 rethinkdb as r | |
import rethinkdb.ast | |
import rethinkdb.net | |
import sys | |
import types | |
import json | |
import ujson |
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
r.table('lexi2').insert([ | |
{net:{lo:{tx:1, rx:2}, eth0:{tx:2, rx:4}}}, | |
{net:{lo:{tx:4, rx:6}, wl0ps4:{tx:7, rx:1}}}, | |
{net:{lo:{tx:14, rx:8}, eth0:{tx:1, rx:5}}}]) | |
r.table('lexi2').reduce( | |
function(left, right){ | |
return { net: | |
left('net').keys().setUnion(right('net').keys()).map( | |
function(iface){ |
OlderNewer