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
def get_hostid_by_itemid(itemid) | |
message = { | |
'method' => 'host.get', | |
'params' => { | |
'itemids' => [itemid.to_s] | |
} | |
} | |
return send_request(message).first["hostid"] | |
end |
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
#!/usr/bin/env ruby | |
require 'gnuplot' | |
require 'ostruct' | |
def read file | |
times = [] | |
File.open(file).each do |line| | |
_,a,_ = line.split(' ') | |
times << Float(a)/1000000 |
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
#!/bin/bash | |
set -e | |
########################## | |
# INSTALL GHC | |
########################## | |
GHC="ghc.tar.bz2" | |
# install depends | |
sudo apt-get install --assume-yes libgmp3c2 |
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
exception NoAnswer | |
val only_capitals = List.filter (fn s => Char.isUpper (String.sub (s,0))) | |
val longest_string1 = foldl (fn (s,m) => if String.size s > String.size m then s else m) "" | |
val longest_string2 = foldl (fn (s,m) => if String.size s >= String.size m then s else m) "" | |
fun longest_string_helper p = foldl (fn (s,m) => if (p (String.size s) (String.size m)) then s else m) "" |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'git' | |
require 'fileutils' | |
# Directory that suppose to be in $PATH | |
bin_dir = File.join(Dir.home, 'bin') | |
smackage_dir = File.join(Dir.home, 'projects/smackage') |
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
(* routines *) | |
fun map f (x::xs) = f x :: map f xs | |
| map _ [] = [] | |
fun concat (x::xs) = x @ concat xs | |
| concat [] = [] | |
fun mapPartial _ [] = [] | |
| mapPartial f (x::xs) = case f x | |
of SOME v => v :: (mapPartial f xs) |
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
target hw1 | |
sources | |
hw1.mlb | |
hw1.main.sml | |
end | |
option compiler = mlton | |
option output = hw1 | |
end |
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 ScopedTypeVariables #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Control.Applicative (many, (<$>), (<*)) | |
import Control.Lens | |
import Data.Attoparsec.Text.Lazy | |
import qualified Data.HashMap.Strict as M | |
import Data.List (nub, sort) | |
import Data.Text.Lazy.IO as T | |
import qualified Algo.BellmanFord as BF |
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
# Deploying haddocks | |
# | |
# cap deploy:haddocks | |
load 'deploy' | |
ssh_options[:forward_agent] = true | |
after "deploy:create_symlink", "deploy:cleanup" |
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 UnicodeSyntax #-} | |
module Adda2.Week1.PrimMST where | |
import Control.Applicative (many, (<$>), (<*)) | |
import Control.Monad (replicateM) | |
import Data.List (nub, sort) | |
import Data.Attoparsec.Text.Lazy | |
import Data.Text.Lazy.IO as T |