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
#!/usr/bin/python | |
import argparse, numpy as np | |
def gen_tree(depth, id, branch): | |
label = id if args.label is None else args.label | |
print ' '*depth + id + '[label="' + label + '"];' | |
if depth >= args.depth: | |
return | |
nchild = np.random.poisson(branch) |
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
# 詳見 「既輕鬆上手又無限擴充的跨平臺文字編輯器 geany」 | |
# http://newtoypia.blogspot.tw/2016/03/geany.html | |
tidy-mark: yes | |
markup: yes | |
wrap: 40 | |
tab-size: 8 | |
indent: auto | |
indent-spaces: 2 | |
output-xhtml: yes | |
doctype: loose |
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
#!/usr/bin/php | |
<?php | |
require_once 'QueryPath/qp.php'; | |
// 若是使用舊版 (2.1.2) 的 QueryPath, 應該這樣寫: | |
// require_once 'QueryPath/QueryPath.php'; | |
// 詳見 「網頁搜括小工具: 用 extract.php 擷取網頁當中的一小塊」 | |
// http://newtoypia.blogspot.tw/2016/03/web-scraping.html | |
// extract.php -s 'div.hentry' < ckhung.html > ckhung2.html |
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
# Fail2Ban configuration file | |
# | |
# Author: Cyril Jaquier | |
# | |
# $Revision$ | |
# | |
# 詳見: 「fail2ban: 新手老手 root 網管都要練的金鐘罩」 | |
# http://newtoypia.blogspot.tw/2016/04/fail2ban.html | |
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
#!/usr/bin/perl -w | |
# 詳見: 「fail2ban: 新手老手 root 網管都要練的金鐘罩」 | |
# http://newtoypia.blogspot.tw/2016/04/fail2ban.html | |
use DateTime; | |
use Getopt::Std; | |
my (%opts) = ( | |
d => 7, # number of days to look back |
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 | |
# 詳見: 「fail2ban: 新手老手 root 網管都要練的金鐘罩」 | |
# http://newtoypia.blogspot.tw/2016/04/fail2ban.html | |
sed -i.bak '/repeated-fail2ban/,+1d' /etc/hosts.deny | |
/etc/fail2ban/repeated-fail2ban.pl -d 7 -g 3 -i 10 >> /etc/hosts.deny | |
cat <<EOF > /etc/apache2/conf.d/repeated-fail2ban | |
<Location /> | |
Order Allow,Deny | |
Allow from all |
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
# Fail2Ban configuration file | |
# 詳見: 「fail2ban: 新手老手 root 網管都要練的金鐘罩」 | |
# http://newtoypia.blogspot.tw/2016/04/fail2ban.html | |
# | |
# Author: Chao-Kuei Hung | |
# | |
# $Revision: 1 $ | |
# | |
[Definition] |
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
# Fail2Ban configuration file | |
# | |
# Author: Chao-Kuei Hung | |
# | |
# $Revision: 1 $ | |
# | |
# 詳見: 「fail2ban: 新手老手 root 網管都要練的金鐘罩」 | |
# http://newtoypia.blogspot.tw/2016/04/fail2ban.html | |
[Definition] |
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
#!/usr/bin/perl -w | |
use strict; | |
use utf8; | |
use Getopt::Std; | |
my (%opts, @header, @decol, $x, $i); | |
%opts = ( | |
d => ',', # delimiter | |
c => '0-', # columns to be de-columned. '0-6,8,12-15' | |
); |
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
/* global $, document, console */ | |
$(document).ready(function (){ | |
// http://stackoverflow.com/questions/9898813/jquery-wait-till-multiple-get-requests-are-successully-processed | |
var f1 = 'https://raw.githubusercontent.com/g0v/potluckmap/gh-pages/data/shop-clothes.csv'; | |
var f2 = 'https://raw.githubusercontent.com/g0v/potluckmap/gh-pages/data/shop-gift.geojson'; | |
var clothes, gift; | |
clothes = $.get(f1); | |
gift = $.get(f2); | |
$.when(clothes, gift).done(init); | |
}); |