RPUSH
,SADD
needs to support multiple values- Command names are case-insensitive, parameter and values are case-sensitive and must be all lowercase.
- If a command doesn't specify return value, please return
OK
if successful, or follow the error code. - Updated sample tests (see link in the sample tests section)
SET
will always overwrite the value for that key
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 <pthread.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#define TOTAL_THREADS 2 | |
#define MAX 10 | |
int shared = 0; | |
int turn = 0; | |
int started = 0; |
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
quicksort :: (Ord a) => [a] -> [a] | |
quicksort [] = [] | |
quicksort (x:xs) = smaller ++ equal ++ greater | |
where smaller = quicksort (filter (<x) xs) | |
equal = x:(filter (==x) xs) | |
greater = quicksort (filter (>x) 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
addStream :: (Num a) => [a] -> [a] -> [a] | |
addStream (x:xs) (y:ys) = x + y : addStream xs ys | |
natural :: [Integer] | |
natural = 1 : addStream natural (repeat 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
#!/bin/bash | |
error () { | |
# USAGE: error <message> <is_fatal> | |
echo -n "!!ERROR!! " 1>&2 | |
echo "$1" 1>&2 | |
if (( "$2" )); then | |
exit 1 | |
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
#! /bin/sh | |
FILENAME=`date +'%Y%m%d'` | |
if test ! -e $FILENAME; then | |
touch $FILENAME | |
fi | |
if test -s $FILENAME; then | |
cat >> $FILENAME <<HORIZONTAL |
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
/* | |
* Copyright (c) 2012 Stefano Sabatini | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
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
(defun powerset (list) | |
"powerset returns the list of sublists of list" | |
(reduce #'(lambda (e l) | |
(nconc (mapcar #'(lambda (l) (cons e l)) l) | |
l)) | |
list | |
:from-end t | |
:initial-value '(nil))) | |
(defun permutation (list) |
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
(defun precedence (op) | |
(cond | |
((or (eq op '*) (eq op '/)) 20) | |
((or (eq op '+) (eq op '-)) 10) | |
(t 0))) | |
(defun infix->postfix (infix-exp) | |
"infix->postfix returns a postfix version of the infix expression passed to it. Currently, it does no error checking and does not support expressions with brackets." | |
(labels ((helper (acc op el iexp) | |
(cond |
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/local/bin/guile \ | |
-e main -s | |
!# | |
(use-modules ((sxml xpath) | |
#:select (sxpath)) | |
(ice-9 getopt-long) | |
(ice-9 ftw)) | |
(define *processors* '()) |
OlderNewer