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 Data.List | |
import Data.List.Split | |
-- 数独を解く | |
solveSudoku matrix | |
| matrix /= solved = solveSudoku solved | |
| solved /= backtracked = solveSudoku backtracked | |
| otherwise = matrix | |
where | |
solved = solveSudokuDirectly matrix |
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
●PTRACE_ATTACH | |
pid で指定されたプロセスに接続 (attach) し、それを現在のプロセスの子プ | |
ロセスとしてトレースできるようにする。子プロセスは PTRACE_TRACEME した | |
かのように振舞う。現在のプロセスはそのほとんどの目的において、 その子プ | |
ロセスの実際の親になる (例えば、子プロセスのイベントの 通知を受けとった | |
り、 ps(1) で親として表示されたりする)。しかし、子プロセスで | |
getppid(2) を実行した場合には元の親プロセスの PID が返される。 子プロセ | |
スには SIGSTOP が送られるが、この呼び出しが完了するまでに 必ずしも停止 | |
するとは限らない。子プロセスの停止を待つには wait(2) を使用すること。 |
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
accept | |
accept4 | |
access | |
acct | |
add_key | |
adjtimex | |
alarm | |
bdflush | |
bind | |
brk |
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 Data.List | |
-- ペル方程式 x^2 - d * y^2 = ±1について、 | |
-- 指定されたdに対して最小の解(x,y)を返す | |
-- 参考:http://www004.upp.so-net.ne.jp/s_honma/pell/pell.htm | |
minSolutionForPellEquation d | |
| even n = ((x_m0^2+d*y_m0^2) `div` h_m, | |
(2*x_m0*y_m0) `div` h_m) | |
| otherwise = ((x_m0*x_m1+d*y_m0*y_m1) `div` h_m, | |
(x_m0*y_m1+x_m1*y_m0) `div` h_m) |
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
last50digits = 55723761467908866712060720593684978725896677308273 | |
findCandidates xs = filter ((lastDigits==).(`mod` m).(^101).read) candidates | |
where | |
candidates = [c:x | c<-['0'..'9'], x<-xs] | |
len = length $ head candidates | |
m = 10^len | |
lastDigits = last50digits `mod` m | |
main = print . take 50 $ iterate findCandidates [""] |
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
diff -c -r php-5.6.2-orig/Zend/zend.h php-5.6.2/Zend/zend.h | |
*** php-5.6.2-orig/Zend/zend.h 2014-10-15 21:59:32.000000000 +0900 | |
--- php-5.6.2/Zend/zend.h 2014-11-02 13:26:51.000000000 +0900 | |
*************** | |
*** 291,298 **** | |
--- 291,300 ---- | |
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC | |
#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__) | |
+ # define ZEND_NORETURN __attribute__((noreturn)) |
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
<?php | |
$values = array(null, true, false, 0, 0.0, '', ' ', '0', '00', '0.0', '0x0', '0X0', 1, 1.0, '1', '01', '1.0', '0x1', '0X1', '1e0', '1E0', 'a', '1a', INF, -INF, NAN, PHP_INT_MAX, ~PHP_INT_MAX, 9223372036854775808.0, '9223372036854775807', '9223372036854775807.0', '9223372036854775808', '9223372036854775808.0', '9999999999999999999.0', '9999999999999999999.1', '10000000000000000000.0', '10000000000000000000.00', '1e19', '1E19'); | |
foreach ($values as $a) { | |
if (is_float($a)) { | |
$a_str = sprintf('%-20.1f', $a); | |
} else { | |
$a_str = var_export($a, true); | |
} | |
foreach ($values as $b) { |
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
<?php | |
class Foo { | |
function __invoke() { | |
echo 'foo'; | |
} | |
function bar(callable $function) { | |
echo 'bar'; | |
} | |
} |
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/bash -e | |
#Check mono version | |
s=`mono --version`; | |
a=( $s ); | |
mono_version=`echo ${a[4]}`; | |
mono_version_major=`echo $mono_version | awk -F"." '{print $1}'` | |
mono_version_minor=`echo $mono_version | awk -F"." '{print $2}'` | |
mono_version_build=`echo $mono_version | awk -F"." '{print $3}'` |
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
public class Overload{ | |
public static void foo(int x){ | |
System.out.println("int"); | |
} | |
public static void foo(double x){ | |
System.out.println("double"); | |
} |