Skip to content

Instantly share code, notes, and snippets.

Avatar

Mitsuo Yoshida ceekz

View GitHub Profile
@ceekz
ceekz / pin.cgi
Created Jun 20, 2014
Create an access token from a consumer key in Twitter.
View pin.cgi
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use Net::Twitter;
my $cgi = new CGI;
View mrtg.cfg
# indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
WorkDir: /var/www/mrtg
Target[eth0]: \eth0:private@localhost:
SetEnv[eth0]: MRTG_INT_IP="localhost" MRTG_INT_DESCR="eth0"
MaxBytes[eth0]: 125000000
Options[eth0]: growright, bits
Title[eth0]: eth0
PageTop[eth0]: <h1>eth0</h1>
View cidfmap.local
/IPAGothic << /FileType /TrueType /Path (/usr/share/fonts/ipa-gothic/ipag.ttf) /CSI [(Japan1) 6] >> ;
/IPAMincho << /FileType /TrueType /Path (/usr/share/fonts/ipa-mincho/ipam.ttf) /CSI [(Japan1) 6] >> ;
/IPAPGothic << /FileType /TrueType /Path (/usr/share/fonts/ipa-pgothic/ipagp.ttf) /CSI [(Japan1) 6] >> ;
/IPAPMincho << /FileType /TrueType /Path (/usr/share/fonts/ipa-pmincho/ipamp.ttf) /CSI [(Japan1) 6] >> ;
/#82l#82r#20#83S#83V#83b#83N /IPAGothic ;
/#82l#82r#83S#83V#83b#83N /IPAGothic ;
/@#82l#82r#83S#83V#83b#83N /IPAGothic ;
/DFHSGothic-W5 /IPAGothic ;
/DFPHSGothic-W5 /IPAGothic ;
View Mecab.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MecabWrapper
{
public class Mecab
{
@ceekz
ceekz / gist:0ad19287e32d0cb514c7
Last active Aug 29, 2015
up/down concordance rate
View gist:0ad19287e32d0cb514c7
sub udcr {
my ($X, $Y) = @_;
if (scalar(@{$X}) < 2 || scalar(@{$X}) != scalar(@{$Y})) {
return;
}
my $j = 0;
for (my $i = 1; $i < scalar(@{$X}); $i++) {
my $_x = $X->[$i] - $X->[$i - 1];
@ceekz
ceekz / wget_wrapper.pl
Last active Oct 7, 2015
Wget Wrapper for a Web Page Cache
View wget_wrapper.pl
#!/usr/bin/perl
# Wget のラッパー
# 任意の URL のページを画像込みで保存する
# $ wget_wrapper.pl Directory URL
# (Directory は URL ごとにユニークなものを指定する)
#
# .htaccess 設定例
# AddType text/html .htmlwget
# DirectoryIndex index.htmlwget index.html index.htm
@ceekz
ceekz / dbbackup.sh
Last active Oct 7, 2015
Backup shell script for MySQL
View dbbackup.sh
#!/bin/sh
keepday=14
dir=/home/dbbackup
file=dump.sql
now_date=`date +%Y%m%d`
old_date=`date "-d$keepday days ago" +%Y%m%d`
cd $dir
@ceekz
ceekz / gist:3099041
Created Jul 12, 2012
An IP address is used at random.
View gist:3099041
# サーバに割り当てた任意の IP アドレスを利用する
# (本コードではランダムに選択)
use LWP::UserAgent (@LWP::Protocol::http::EXTRA_SOCK_OPTS);
# ランダムに IP を選択
{
my @IP = qw(
203.0.113.1
203.0.113.2
View gist:4506257
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);
View sign_test.pl
# 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);
You can’t perform that action at this time.