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
/* mail.google.com */ | |
table img[title*=".zip" i], table img[title*=".rar" i], table img[title*=".gz" i], table img[title*=".tar" i], table img[title*=".bz2" i] { | |
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important;background-image: url(https://ssl.gstatic.com/docs/doclist/images/mediatype/icon_1_archive_x16.png) !important; | |
} | |
table img[title*=".txt" i], table img[title*=".rtf" i], table img[title*=".csv" i], table img[title*=".tsv" i] { | |
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important; background-image:url(https://ssl.gstatic.com/docs/doclist/images/mediatype/icon_1_text_x16.png) !important; | |
} | |
table img[title*=".c" i], table img[title*=".pl" i], table img[title*=".sql" i] { | |
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important; background- |
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
set ttt=%1 | |
set tt=%ttt:~0,-4% | |
gswin32c -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sFONTPATH=%windir%/fonts;xfonts;. -sPDFPassword= -dPDFSETTINGS=/prepress -dPassThroughJPEGImages=true -sOutputFile="%tt%_noPW.pdf" %1 |
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
# -*- coding: utf-8 -*- | |
# See documentation in: | |
# https://doc.scrapy.org/en/latest/topics/commands.html#custom-project-commands | |
from scrapy.commands import ScrapyCommand | |
from scrapy.crawler import CrawlerProcess | |
from scrapy.utils.project import get_project_settings | |
class Command(ScrapyCommand): |
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
use Data::Pageset; | |
$self->helper( | |
pagination => sub { | |
my ($self, $total_entries, $current_page) = @_; | |
my $dp = Data::Pageset->new({ | |
'total_entries' => $total_entries, | |
'entries_per_page' => 20, | |
'current_page' => (! $current_page || $current_page < 1) ? 1 : $current_page, |
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
use Text::MeCab; | |
our $mecab = Text::MeCab->new({ node_format => "%M" }); | |
sub get_terms { | |
my $str = shift; | |
my @terms; | |
my @surfaces; | |
for (my $node = $mecab->parse($str); $node; $node = $node->next) { | |
my @feature = split /,/, $node->feature; |
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
sub snippet { | |
my ($text, $terms, $max, $tag_s, $tag_e) = @_; | |
utf8::decode($text); | |
if (length($text) < $max) { | |
return $text; | |
} | |
if (! ref($terms)) { |
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
use List::Util; | |
sub cosine_similarity { | |
my ($vector_1, $vector_2, $is_pearson) = @_; | |
my %union; | |
foreach (keys %{$vector_1}, keys %{$vector_2}) { | |
$union{$_}++; | |
} | |
my $avg_1 = List::Util::sum(values %{$vector_1}) / scalar(keys %union); |
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
# Reference: | |
# http://aoki2.si.gunma-u.ac.jp/lecture/Average/sign-test.html | |
# http://kusuri-jouhou.com/statistics/fugou.html | |
use strict; | |
use warnings; | |
use List::Util; | |
my @sign = qw(1 0 1 1 -1 1 1 -1 1 1); |
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
use List::Util; | |
sub add_cloud_font_size { | |
my ($font_size_min, $font_size_max, $val_col, @lists) = @_; | |
if (scalar(@lists) == 0) { | |
return; | |
} | |
my $val_min = log(List::Util::min(map { $_->{$val_col} } @lists) + 1); | |
my $val_max = log(List::Util::max(map { $_->{$val_col} } @lists) + 1); |
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
# サーバに割り当てた任意の IP アドレスを利用する | |
# (本コードではランダムに選択) | |
use LWP::UserAgent (@LWP::Protocol::http::EXTRA_SOCK_OPTS); | |
# ランダムに IP を選択 | |
{ | |
my @IP = qw( | |
203.0.113.1 | |
203.0.113.2 |
NewerOlder