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 math import sqrt, ceil | |
class SkipList: | |
def __init__(self, list, i=0): | |
self.list=list | |
self.len=len(self.list) | |
self.interval=ceil(sqrt(self.len)) | |
self.i=i | |
def next(self): |
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
var isAlpha = function(s) { return /^[a-zA-Z]+$/.test(s) } | |
var soundex = function(s) { | |
if(s==='') | |
return '0000' | |
const | |
head = s[0].toLowerCase(), | |
tail = s.substr(1).toLowerCase() | |
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
function soundex(s::String) | |
const head = lowercase(s[1]) | |
const tail = lowercase(s[2:end]) | |
const dict= [ "a"=>"", "e"=>"", "i"=>"", "o"=>"", "u"=>"", "y"=>"", "h"=>"", "w"=>"", "b"=>"1", "f"=>"1", "p"=>"1", "v"=>"1", "c"=>"2", "g"=>"2", "j"=>"2", "k"=>"2", "q"=>"2", "s"=>"2", "x"=>"2", "z"=>"2", "d"=>"3", "t"=>"3", "l"=>"4", "m"=>"5", "n"=>"5", "r"=>"6"] | |
const t=split(tail,"") | |
const t1=map(x->dict[x],t) | |
output=ASCIIString[] |
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
# 1. Delete all existing rules | |
iptables -F | |
# 2. Set default chain policies | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT DROP | |
# 4. Allow ALL incoming SSH | |
iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT |
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
function dda(x0, y0, x1, y1) | |
{ | |
const dx = x1 - x0, | |
dy = y1 - y0, | |
s = Math.abs(dx) > Math.abs(dy) ? Math.abs(dx) : Math.abs(dy), | |
xi = dx * 1.0 / s, | |
yi = dy * 1.0 / s | |
var x = x0, | |
y = y0, |
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
iptables -F | |
#Prevent DDOS, kudos to Digital Ocean | |
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP | |
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP | |
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT |
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
mount -o umask=0000,dmask=0000 -t vfat /dev/block/mmcblk0p20 /storage/sdcard1 |
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
// |
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 sequenceiq/spark:1.1.0 | |
MAINTAINER Rizky [email protected] | |
RUN git clone git://gist.github.com/2a229e3a7cc88cc442fe.git | |
#RUN git clone git://bitbucket.org/rilut/tk.git | |
CMD ["/etc/bootstrap.sh", "-d"] |
OlderNewer