Skip to content

Instantly share code, notes, and snippets.

View mix3's full-sized avatar

mix3@サタデーナイトフィーバー mix3

View GitHub Profile
@mix3
mix3 / generate_app.pl
Created February 8, 2011 16:18
Ark skeletone project generater
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
use Data::Section::Simple qw/get_data_section/;
if($#ARGV < 0){
@mix3
mix3 / autopagerize.user.js
Created February 13, 2011 14:34
pixiv用autopagerize設定
var SITEINFO = [
{
url: 'http://www.pixiv.net/member_illust.php\\?mode=medium&illust_id=',
nextLink: '//div[@class="centeredNavi"]/ul/li/a[contains(text(),"≫")]',
pageElement: '//div[@class="two_column_body"]',
},
]
@mix3
mix3 / cassandra_thrift_perl_sample.pl
Created March 15, 2011 06:29
Accessing Cassandra 0.7.0 from Perl
#!/usr/bin/env perl
use strict;
use warnings;
use lib $ENV{'CASSANDRA_HOME'}.'/interface/gen-perl/';
use Cassandra::Cassandra;
use Cassandra::Constants;
use Cassandra::Types;
@mix3
mix3 / insert_or_update.pl
Created March 15, 2011 07:02
Accessing Cassandra 0.7.0 from Perl
#!/usr/bin/env perl
use strict;
use warnings;
use lib $ENV{'CASSANDRA_HOME'}.'/interface/gen-perl/';
use Cassandra::Cassandra;
use Cassandra::Constants;
use Cassandra::Types;
@mix3
mix3 / gist:879419
Created March 21, 2011 13:03
useしてるものを取り出してみる
grep use lib/ -h -r | perl -e '%hash; while(<>){if(/use (\w+(::)?)+/){if($& =~ /use (.+)/){$hash{$1}++}}}; foreach(keys %hash){print $_."\n"}' | egrep -v 'strict|warnings|base' | xargs
@mix3
mix3 / while_show_slave_status.sh
Created April 6, 2011 04:37
MySQLのSlaveの遅延をチェック 遅延発生で赤色に
#!/bin/sh
color() {
printf '\033[%sm%s\033[m\n' "$@"
}
while true
do
DATE=`date | sed -e 's/\r\n/\n/g' | sed -e 's/\n//g'`
SBM=`echo "show slave status\G" | mysql -u root | grep Seconds | sed -e 's/ Seconds_Behind_Master: //g'`
@mix3
mix3 / commentout.vim
Created April 18, 2011 13:50
commentout.vim
" lhs comments
vmap ,# :s/^/#/<CR>:nohlsearch<CR>
vmap ,/ :s/^/\/\//<CR>:nohlsearch<CR>
vmap ,> :s/^/> /<CR>:nohlsearch<CR>
vmap ," :s/^/\"/<CR>:nohlsearch<CR>
vmap ,% :s/^/%/<CR>:nohlsearch<CR>
vmap ,! :s/^/!/<CR>:nohlsearch<CR>
vmap ,; :s/^/;/<CR>:nohlsearch<CR>
vmap ,- :s/^/--/<CR>:nohlsearch<CR>
vmap ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR>
@mix3
mix3 / xslate_crud.pl
Created April 23, 2011 17:09
Mojolicious::Lite + Teng + SNBinder + Xslate (+ SQLite/OnMemory)でCRUDアプリ
package Message;
use parent 'Teng';
__PACKAGE__->load_plugin('Pager');
use Class::Method::Modifiers;
around delete => sub {
my ($orig, $self, $table_name, $delete_condition) = @_;
my $update_row_data = {
deleted_at => DateTime->now->set_time_zone('Asia/Tokyo'),
@mix3
mix3 / crud.pl
Created April 23, 2011 15:51
Mojolicious::Lite+Teng+SNBinder(+SQLite/In-Memory)でCRUDアプリ
package Message;
use parent 'Teng';
__PACKAGE__->load_plugin('Pager');
use Class::Method::Modifiers;
around delete => sub {
my ($orig, $self, $table_name, $delete_condition) = @_;
my $update_row_data = {
deleted_at => DateTime->now->set_time_zone('Asia/Tokyo'),
@mix3
mix3 / ajax_crud.pl
Created April 23, 2011 18:19
Mojolicious::Lite + Teng + SNBinder + Xslate + ajax/jQuery (+ SQLite/OnMemory) でCRUDアプリ(未完)
package Message;
use parent 'Teng';
__PACKAGE__->load_plugin('Pager');
use Class::Method::Modifiers;
around delete => sub {
my ($orig, $self, $table_name, $delete_condition) = @_;
my $update_row_data = {
deleted_at => DateTime->now->set_time_zone('Asia/Tokyo'),