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
class SchTasks | |
def initialize(password = nil) | |
@password = password | |
end | |
def include?(taskname) | |
schtasks('/query', '/nh') do |f| | |
f.read =~ /^#{taskname}/ | |
end | |
end |
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
@ruby -x "%~f0" %* | |
@exit /b | |
#!ruby -Ks | |
require 'Win32API' | |
GetShortPathName = Win32API.new('kernel32', 'GetShortPathName', 'ppi', 'i') | |
def get_short_path_name(path) | |
len = GetShortPathName.call(path, nil, 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
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-} | |
module PauseMonad | |
( MonadPause (..) | |
, Pause (..) | |
, PauseT (..) | |
, tracePauseT | |
, module Control.Monad.Trans | |
) where |
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 FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, FunctionalDependencies #-} | |
module YieldMonad | |
( MonadYield (..) | |
, Yield (..) | |
, YieldT (..) | |
, traceYieldT | |
, module Control.Monad.Trans | |
) where |
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 FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, FunctionalDependencies #-} | |
module Var | |
( MonadVar (..) | |
, module Control.Monad.Trans | |
) where | |
import Control.Monad.Error | |
import Control.Monad.State | |
import Control.Monad.Reader |
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
export PATH=~/bin:$PATH | |
export LANG=ja_JP.UTF-8 | |
PS1="\\t \[\e[32m\]\\w\[\e[\$((\$? ? 33 : 36))m\]> \[\e[0m\]" | |
complete -d cd | |
complete -c man | |
alias rm='rm -i' | |
alias ..='cd ..' | |
alias l='ls -l' |
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
import Control.Applicative | |
-- Control.Monad stuff in Applicative | |
-- Data.Traversable has generalized version | |
mapA :: Applicative f => (a -> f b) -> [a] -> f [b] | |
mapA f xs = sequenceA (map f xs) | |
mapA_ :: Applicative f => (a -> f b) -> [a] -> f () | |
mapA_ f xs = sequenceA_ (map f 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
import Control.Applicative | |
data Vector2 a = Vector2 a a deriving (Show, Eq) | |
instance Applicative Vector2 where | |
pure x = Vector2 x x | |
Vector2 fx fy <*> Vector2 x y = Vector2 (fx x) (fy y) | |
instance Functor Vector2 where | |
fmap = liftA |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
#ifndef ungetchar | |
#define ungetchar(c) ungetc((c), stdin) | |
#endif | |
typedef struct tree Tree; |
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
#ifndef DEBUG_H_ | |
#define DEBUG_H_ | |
#ifdef _MSC_VER | |
# define DEBUG_H_FUNCTION_NAME __FUNCTION__ | |
#else | |
# define DEBUG_H_FUNCTION_NAME __func__ | |
#endif | |
#define PrintInfoFormatIntlIntl(p,line) \ |
OlderNewer