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 escript | |
%%! -name port_inspector | |
-module(port_inspector). | |
-export([inspect/0, main/1]). | |
%% | |
%% Info Collection Routines | |
%% | |
inspect() -> |
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 BangPatterns #-} | |
import Data.Maybe | |
import Data.Array | |
import Data.Int | |
data Relation = G | L | N deriving (Show, Enum, Ord, Eq, Bounded) | |
data SCond = Any | F !Relation !Int64 deriving (Show, Ord, Eq) | |
key (Any, n) = (-1, -1, n) |
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
(* | |
Please note: this is my ad-hoc script and it possibly contains bugs and strange behaviour. | |
It's also may be convenient to consolidate iTunes library after usage. | |
*) | |
on dedup(aList) | |
set res to {} | |
repeat with i from 1 to (length of aList) | |
set cur to item i of aList | |
if {cur} is not in res then set res to (res & {cur}) |
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
-module(match_spec_from_record). | |
-export([hooks_for_scope/2]). | |
-record(hooks, { | |
scope :: atom(), | |
pid :: pid(), | |
pre :: mfa(), | |
post :: mfa() |
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
{- | |
Bal ::= (Bal)Bal | [Bal]Bal | "" | |
-} | |
import Control.Monad | |
brackets = [('[',']'), ('(',')')] | |
isObr b = elem b (map fst brackets) | |
isCoBr b1 b2 = elem (b1,b2) brackets || elem (b2,b1) brackets |
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
-module(sp_config_srv). | |
-behaviour(gen_server). | |
-define(NODEUP_PAUSE, 100). | |
%% ------------------------------------------------------------------ | |
%% API Function Exports | |
%% ------------------------------------------------------------------ | |
-export([ |
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
-module(pdscope). | |
-export([pput/1, pget/0, pdscope/1, example/0]). | |
pput(X) -> | |
erlang:put(?MODULE, X). | |
pget() -> | |
erlang:get(?MODULE). | |
pdscope(Scope, F) -> |
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
cowboy_config() -> | |
{ok, App} = application:get_application(), | |
Disp = [ | |
{'_', [ | |
{[<<"combiners">>, <<"test">>], combiner_test_src, []}, | |
{[<<"combiners">>, <<"list">>], combiners_list, []}, | |
{[<<"combiners">>, <<"info">>, comb_name], combiner_info, []}, | |
{[<<"combiners">>, '...'], cowboy_http_static, [ | |
{directory, {priv_dir, App, []}}, | |
{mimetypes, [ |
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
data IntSet = Empty | |
| Node { val :: Int, | |
left :: IntSet, | |
right :: IntSet } deriving Show | |
incl Empty x = Node x Empty Empty | |
incl node x | x < val node = node { left = incl (left node) x } | |
| x > val node = node { right = incl (right node) x } | |
| otherwise = node |
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
(define-syntax class | |
(syntax-rules (extends rmethods method) | |
((_ rmethods () r) `r) | |
((_ rmethods ((method (name arg1 ...) body ...) . methods) r) | |
(class rmethods methods ((name . ,(lambda (self arg1 ...) body ...)) . r))) | |
((_ header (extends parent) body ...) | |
(define header | |
(define methods (class rmethods (body ...) ())) | |
(make-dispatcher-self (extends (make-dict methods) parent)))) | |
((_ header body ...) |