This file contains hidden or 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 BangPatterns #-} | |
module LLRBTree where | |
import Data.List (foldl', nub, (\\)) | |
import qualified Data.List as L | |
import Data.Maybe | |
import System.Cmd | |
import Prelude hiding (minimum) | |
import Debug.Trace | |
import Test.QuickCheck |
This file contains hidden or 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
// ==UserScript== | |
// @name Duomi Download | |
// @namespace http://diveintogreasemonkey.org/download/ | |
// @description Easy to download duomi music | |
// @include http://huodong.duomi.com/* | |
// ==/UserScript== | |
var unsafeWindow = (function () { | |
var dummyElem = document.createElement('p'); | |
dummyElem.setAttribute('onclick', 'return window;'); |
This file contains hidden or 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 DeriveDataTypeable #-} | |
module Main where | |
import Control.Concurrent ( threadDelay ) | |
import Data.Binary | |
import Data.Typeable | |
import Control.Distributed.Process | |
import Control.Distributed.Process.Node |
This file contains hidden or 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
<?php | |
$param1 = "哈哈1\t𤭢2\\3\""; | |
$param2 = "10"; | |
$param11 = "哈\xd5\"哈1\t𤭢2\\3\""; | |
$param22 = "10 union 1,2"; | |
$sql1 = "select * from user where username=" . literal($param1) . " and age=" . literal(intval($param2)); | |
$sql2 = "select * from user where username=" . literal($param1) . " and age=" . literal($param2); | |
$sql3 = "select * from user where username=" . literal($param11) . " and age=" . literal(intval($param2)); |
This file contains hidden or 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 Data.List | |
floors = 0 : 1 : map step [2..] | |
where step h = minimum [ 1 + max (x-1) (floors!!(h-x)) | x <- [1..h-1] ] | |
main = print $ take 200 floors |
This file contains hidden or 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
package util; | |
import org.springframework.util.Assert; | |
import java.math.BigDecimal; | |
import java.util.Iterator; | |
public class Test { | |
public static void main(String[] args) { |
This file contains hidden or 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 <iostream> | |
#include <string> | |
#include <sstream> | |
#include <fstream> | |
#include <set> | |
#include <map> | |
#include <algorithm> | |
using namespace std; |
This file contains hidden or 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
module Main where | |
import Text.ParserCombinators.Parsec | |
import Control.Applicative ((*>), (<*), (<*>), (<$>), (<$), empty) | |
import Numeric (readHex, readSigned, readFloat) | |
run :: Show a => Parser a -> String -> IO () | |
run p input = case (parse p "" input) of | |
Left err -> do putStr "parse error at " | |
print err |
This file contains hidden or 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
module Main where | |
----------------------------------------------------------------------------- | |
---- | | |
---- | |
---- 输出最长回文子串, 直观版。 | |
---- | |
------------------------------------------------------------------------------- | |
import Data.List (maximumBy) | |
import Data.Function (on) |
This file contains hidden or 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
-- http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/ | |
module Main where | |
class Fluffy f where | |
furry :: (a -> b) -> f a -> f b | |
-- Exercise 1 | |
-- Relative Difficulty: 1 | |
instance Fluffy [] where | |
furry _ [] = [] |