Skip to content

Instantly share code, notes, and snippets.

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))
@hnw
hnw / prob17.hs
Created September 18, 2014 07:14
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 [""]
@hnw
hnw / pell.hs
Last active August 29, 2015 14:05
Pell's equation solver
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)
accept
accept4
access
acct
add_key
adjtimex
alarm
bdflush
bind
brk
●PTRACE_ATTACH
pid で指定されたプロセスに接続 (attach) し、それを現在のプロセスの子プ
ロセスとしてトレースできるようにする。子プロセスは PTRACE_TRACEME した
かのように振舞う。現在のプロセスはそのほとんどの目的において、 その子プ
ロセスの実際の親になる (例えば、子プロセスのイベントの 通知を受けとった
り、 ps(1) で親として表示されたりする)。しかし、子プロセスで
getppid(2) を実行した場合には元の親プロセスの PID が返される。 子プロセ
スには SIGSTOP が送られるが、この呼び出しが完了するまでに 必ずしも停止
するとは限らない。子プロセスの停止を待つには wait(2) を使用すること。
import Data.List
import Data.List.Split
-- 数独を解く
solveSudoku matrix
| matrix /= solved = solveSudoku solved
| solved /= backtracked = solveSudoku backtracked
| otherwise = matrix
where
solved = solveSudokuDirectly matrix
using System;
using System.Linq;
using System.Collections.Generic;
class Prime
{
private static List<int> odd_primes = new List<int>();
private static bool IsPrime(int val)
{
using System;
using System.Linq;
using System.Collections.Generic;
class Prob1
{
static void Main()
{
IEnumerable<int> nums =
from num in Enumerable.Range(1, 1000-1)
› ls $HOME/lib/emacs/*
lib/emacs/auto-save-buffers.el lib/emacs/flymake-cursor.el lib/emacs/minibuf-isearch.el lib/emacs/yaml-mode.el
lib/emacs/cc-subword.el lib/emacs/flymake.el lib/emacs/moz.el
lib/emacs/dabbrev-ja.el lib/emacs/jaspace.el lib/emacs/session.el
lib/emacs/org-7.7:
Makefile README contrib doc lisp request-assign-future.txt
lib/emacs/php:
php-completion-file
› brew list
advancecomp freetype libevent node python
aspell gcal libffi nspr qt
autoconf gd libgcrypt optipng re2c
automake gdbm libgpg-error ossp-uuid readline
bazaar gettext libiconv p7zip rrdtool
bdw-gc ghc libksba pango serf
bison gibo libmemcached pcre socat
boost git libpng phantomjs source-highlight
cabal-install glib libtiff php53 spidermonkey