Skip to content

Instantly share code, notes, and snippets.

{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Base File (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Monaco",
"font_size": 12,
@songpp
songpp / Huffman.hs
Last active August 29, 2015 14:01
haskell huffman code
{-# LANGUAGE TupleSections #-}
module Huffman where
import qualified Data.ByteString (ByteString)
import Data.Map (Map)
import qualified Data.Map as Map
data Tree a = Node Int (Tree a) (Tree a) | Leaf a Int deriving Show
data Bit = L | R deriving Show
import Control.Monad
import System.Exit
import Control.Concurrent
import Control.Concurrent.MVar
data Person = John | Jeff | Emma | Steve | Julie deriving (Show, Enum)
next Julie = John
next p = succ p
@songpp
songpp / java_homes.sh
Created July 16, 2014 02:45
OS X打印所有已经安装的java版本以及路径
#! /bin/sh
VERS="1.6 1.7 1.8"
for i in $VERS; do
echo "$i => $(/usr/libexec/java_home -v $i)";
done
@songpp
songpp / Params.hs
Last active August 29, 2015 14:06
a tiny, lovely generic (type indexed) parameter container
-- @Author: spp
-- @Date: 2014-09-26 17:16:53
-- @Last Modified by: spp
-- @Last Modified time: 2014-09-26 17:21:58
{-# LANGUAGE DataKinds, ScopedTypeVariables, DeriveDataTypeable, Rank2Types, ExistentialQuantification #-}
module Params(
Params,
Param,
mkParam,
@songpp
songpp / hsdev_scan.sh
Created February 17, 2015 07:10
haskell hsdev utilities
#! /bin/bash
THIS_PROJECT=$(cd "$(dirname "$0")"; pwd);
THIS_PROJECT_DIR_NAME=$(basename "$THIS_PROJECT");
MY_SANDBOX=~/tools/dev-sandbox/;
set -x;
exec 3>&1
rescan() {
hsdev start --port 4567 --cache "$THIS_PROJECT/.hsdev" >&3;
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files
# modified by m@rkj.me - fix sed syntax issue in OS X
# modified by songpengpeng - fix sed newline issue in OS X
#
# Generate an SVN-compatible diff against the tip of the tracking branch
@songpp
songpp / jvm-parameters
Created July 7, 2015 09:04
print jvm default parameters
java -XX:+PrintFlagsFinal -version
package algrithsm
import annotation.tailrec
/**
* User: flower
* Date: 11-1-18
* Time: 下午6:22
* Description:
*/
@songpp
songpp / IP.hs
Created January 18, 2011 10:11
parse ip data by haskell -- in-complete
module IP where
import System.IO
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.UTF8 as UTF8
import Data.Binary.Get
import Data.Word
import Data.Char
import Numeric
import Data.Bits