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 | |
srcaddr=$(ifconfig hn0 | grep -o '2001:f[67][0-9a-f:]*') | |
dstaddr=$(drill dgw.xpass.jp aaaa | grep -o '2001:f[67][0-9a-f:]*') | |
ifconfig gif0 create | |
ifconfig gif0 inet6 -accept_rtadv -auto_linklocal tunnel $srcaddr $dstaddr | |
ifconfig gif0 up mtu 1500 | |
route -4 delete default | |
route -4 add default -interface gif0 -mtu 1240 | |
sysctl net.inet.ip.forwarding=1 | |
ifconfig gif0 |
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
def up(a,x,i=j=a.size) a[i]=a[i=j] while 0<=j=(i-1)>>1 and a[j]<x; a[i]=x end | |
def down(a,x=a.pop,i=0,n=a.size-1) | |
while n >= i+=1+j=i | |
y=a[i]; n>i&& y<a[i+1]&& y=a[i+=1]; x<y ? a[j]=y: break end; a[0]&& a[j]=x | |
end | |
def heapify(a,n=a.size); i=0; up(a,a[i],i) while n > i+=1 end | |
def sort(a,n=a.size) | |
heapify(a,n); (x,a[n] = a[n],a[i=j=0]; down(a,x,0,n-1)) while 0 < n-=1; a | |
end |