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 | |
IP_ADDR1=`LANG=C /sbin/ifconfig \ | |
| grep '^\s*inet addr' \ | |
| grep -v '\b127\.0\.0\.1\b' \ | |
| head -1 \ | |
| awk '{print $2}' \ | |
| cut -d: -f2` | |
echo "[$IP_ADDR1]" |
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
;; AtCoder 過去問 : 001-A 【センター採点】 | |
;; http://arc001.contest.atcoder.jp/tasks/arc001_1 | |
(defn q001-a* | |
[N cs] | |
(let [lafi (juxt last first)] | |
(->> cs | |
(reduce (fn [m c] (assoc m c (inc (m c)))) | |
{\1 0 \2 0 \3 0 \4 0}) | |
vals (into (sorted-set)) |
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
;; AtCoder 過去問 : 001-B 【リモコン】 | |
;; http://arc001.contest.atcoder.jp/tasks/arc001_2 | |
(defn- q001-b* | |
[A B] | |
(letfn [(loop- [a b d acc xs] | |
(cond | |
(zero? d) acc | |
(empty? xs) (+ acc d) | |
:else (let [[x & xs] 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
;; AtCoder 過去問 : 001-C 【パズルのお手伝】 | |
;; http://arc001.contest.atcoder.jp/tasks/arc001_3 | |
(use '[clojure.set :only (difference)]) | |
(use '[clojure.math.combinatorics :only (permutations)]) | |
(def ^{:private true} r8 (range 1 9)) | |
(defn accession-pos-set | |
"座標 x y に置かれた Q の利き筋列挙" |
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
;; AtCoder 過去問 : 001-D 【レースゲーム】 | |
;; http://arc001.contest.atcoder.jp/tasks/arc001_4 | |
(defn- read-input | |
[] | |
(letfn [(read-num-pair | |
[] (->> (clojure.string/split (read-line) #"\s+") | |
(map #(Long/parseLong %)))) | |
(read-num-pairs | |
[n] (repeatedly n read-num-pair))] |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
static class Ex { | |
public static IEnumerable<IEnumerable<T>> RotationsL<T>(this IEnumerable<T> xs) { | |
for(int i = xs.Count(); i > 0; i--) { | |
yield return xs; | |
xs = xs.Concat(xs.Take(1)).Skip(1); |
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
// 辞書順で順列列挙 | |
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
static class Ex { | |
private static IEnumerable<IEnumerable<T>[]> __MoveRtoL<T>(IEnumerable<T> e1, IEnumerable<T> e2) { | |
while(e2.Count() > 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
from __future__ import print_function | |
import wpf | |
from System.Windows import Application | |
from System.Windows import Window | |
flip = lambda f, a: lambda b: f(b, a) | |
props = {'__init__' : flip(wpf.LoadComponent, 'w.xaml')} | |
win = type('', (Window,),props)() |
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
;; 逆 FizzBuzz | |
;; ------------------------------------------------ | |
;; :dependencies [[org.clojure/clojure "1.4.0"] | |
;; [org.clojure/core.incubator "0.1.0"] | |
;; [org.clojure/math.numeric-tower "0.0.1"]] | |
;; ------------------------------------------------- | |
(ns inv-fizzbuzz.core | |
(:use [clojure.core.incubator :only (-?>>)]) |
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
(require 'cl) | |
(loop for x from 1 to 10000 | |
do (insert (format "Case %d: a = %s\n" | |
x (if (zerop (% x 2)) "False" "True")))) |