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 Main where | |
import Directory (getDirectoryContents) | |
import Data.Tree (drawTree, unfoldTreeM) | |
import System.Environment (getArgs) | |
import Control.Applicative ((<$>), (<*>), pure) | |
import System.Posix.Files (isSymbolicLink, isDirectory, | |
readSymbolicLink,getSymbolicLinkStatus) | |
import System.FilePath.Posix ((</>), takeFileName) | |
main = getArgs >>= \args -> case args of |
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 Main where | |
import List (unfoldr, transpose, sort, (\\)) | |
import System.Environment (getArgs) | |
import Control.Monad (foldM,msum) | |
type Nums = [Int] | |
solveProblems :: FilePath -> IO () | |
solveFile :: FilePath -> IO () | |
solveStr :: String -> String | |
test :: [[Nums]] -> Maybe [[Nums]] |
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
<project name="Build Test" default="all" basedir="." > | |
<target name="all" depends="deploy"/> | |
<property name="tgtdir" value="/tmp"/> | |
<!-- パーミッションを気にする場合はcpを使うのが楽そう。 | |
--parentがサポートされてない場合はcopyタスクとchownで頑張らないとかも | |
<target name="deploy_apps" > | |
<apply executable="cp" dest="/tmp" parallel="false"> | |
<arg value="--parent"/> | |
<srcfile/> |
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
#!/bin/sh | |
MY_NAME=$0; | |
BASE_NAME=${0##*/}; | |
DIR_NAME=${0%/*}; | |
DIRDIR_NAME=${0%/*/*}; | |
DEF_NAME=${_HIDDEN_NAME:-default} | |
echo $BASE_NAME; | |
echo $DIR_NAME; |
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
local function protect_table(tbl) | |
return setmetatable ({}, { | |
__index = tbl, | |
__newindex = function (t, n, v) | |
error ("attempting to change constant " .. | |
tostring (n) .. " to " .. tostring (v), 2) | |
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
EventMachine = {--[[static members]]} | |
function EventMachine:new() | |
local this = { | |
current_actor = nil, | |
receivers_list = {}, | |
event_register = {} | |
} | |
local on_mt = { |
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 Main where | |
import System.Environment (getArgs) | |
main = getArgs >>= \(f:_) -> readFile f >>= putStrLn . fromString | |
fromString = unlines . reverse . tocStr . lines | |
tocStr input = tocStr' input (repeat 0) [] | |
where | |
tocStr' [] _ rs = rs |
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 <Foundation/Foundation.h> | |
@interface NSObject(SimpleArchiver) | |
// example: | |
// (archive) | |
// [SomeClass simpleArchiveForKey:@"a_key"]; | |
// (unarchive) | |
// SomeClass *a_obj = [SomeClass simpleUnarchiveForKey:@"a_key"]; | |
- (BOOL)simpleArchiveForKey:(NSString *)key; | |
+ (id)simpleUnarchiveForKey:(NSString *)key; |
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 <sys/proc_info.h> | |
#include <sys/sysctl.h> | |
#include <libproc.h> | |
void dump_process_memory_usage() | |
{ | |
size_t size = 0; | |
// 全てのプロセスのPIDを取得 | |
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 }; | |
sysctl(mib, 4, NULL, &size, NULL, 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
@interface BundleHelper : NSObject | |
+ (void)retrieveIconURLForBundleID:(NSString *)bundle_id withHandler:(void (^)(NSURL *url))handler; | |
@end | |
@implementation BundleHelper | |
+ (void)retrieveIconURLForBundleID:(NSString *)bundle_id withHandler:(void (^)(NSURL *))handler | |
{ | |
// カレントロケールからストアの国を推定 | |
static NSString *country; | |
NSLocale *currentLocale = [NSLocale currentLocale]; |
OlderNewer