Skip to content

Instantly share code, notes, and snippets.

View xtetsuji's full-sized avatar

OGATA Tetsuji xtetsuji

View GitHub Profile
@xtetsuji
xtetsuji / solve-onedrive.pl
Created February 19, 2014 16:10
Solve OneDrive puzzle.
#!/usr/bin/env perl
# https://twitter.com/onedrive/status/436167285259382784
use strict;
use warnings;
my %mapping = (qw/
A 3
B 0
C Q
@xtetsuji
xtetsuji / ClutchWorker.pm
Last active August 29, 2015 13:57
Clutch, a perl one of jobqueue system's sample.
package My::ClutchWorker;
use strict;
use warnings;
use Clutch::Worker;
register_function(
'echo' => sub {
my $args = shift;
$$ .':'. $args; # return worker process response.
@xtetsuji
xtetsuji / JonkWorker.pm
Last active August 29, 2015 13:57
Jonk, a perl one of jobqueue system's sample.
package My::JonkWorker;
use strict;
use warnings;
use Data::Dumper;
sub work {
my ($class, $job) = @_;
print "job is " . Dumper($job) . "\n";
@xtetsuji
xtetsuji / QudoWorker.pm
Created March 25, 2014 01:41
Qudo, a perl one of jobqueue system's sample.
package My::QudoWorker;
use base 'Qudo::Worker';
use Data::Dumper;
sub work {
my ($class, $job) = @_;
print $job->arg; #print $user->email;
@xtetsuji
xtetsuji / battery-watchd
Created April 18, 2014 18:01
Battery watcher and observer for Mac and Linux laptop.
#!/usr/bin/env perl
# xtetsuji by 2014/04/19
our $VERSION = "0.01";
use strict;
use warnings;
use utf8;
use AnyEvent;
@xtetsuji
xtetsuji / mydb-insert.pl
Created April 20, 2014 08:05
Perl SQLite connection, insert and select sample for beginner education. (ビギナー教育用の簡単なPerl SQLite接続とINSERTとSELECTのサンプル)
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
binmode STDOUT, ':utf8';
use DBI;
my $dbfile = "mydb.sqlite3";
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","");
#!/bin/bash
# plenvを自動的に入れてくれるやつです
set -e
if [[ $(which plenv 2> /dev/null) ]]; then
echo 'plenv already installed.'
elif [[ ! $(which git) ]]; then
echo 'git is not installed!!!!!!!'
exit 1;
@xtetsuji
xtetsuji / README.md
Created June 1, 2014 15:53
In my Mac OS X enviromnent, when it changes Wi-Fi network, then some processes is called system by Perl Cocoa::* modules, and ancient wakeonlan.

#NAME

macwland - Mac 無線変更検知フレームワークのサンプル

#SYNOPSIS

macwland &

#DESCRIPTION

@xtetsuji
xtetsuji / check_mysql_slavestatus
Last active August 29, 2015 14:05 — forked from taka3110/check_mysql_slavestatus.sh
Nagios plugin of MySQL slave check from "SHOW SLAVE STATUS".
#!/bin/sh
#
# Forked at 2014/08/12
# Modifier: OGATA Tetsuji <github:xtetsuji>
# Source: https://gist.github.com/xtetsuji/d82125bfab2247d6cc96
#
# Thanks to original:
# File: check_mysql_slavestatus.sh
# Release Version: 0.1.1
# Created 2012/12/10
@xtetsuji
xtetsuji / wget.c
Created August 21, 2014 16:04
10年くらい前の大昔に書いたwgetと同名のジョークコマンド
#include <stdio.h>
int main(int a, char *b[]) {
int i, j;
char buf[256];
char *get[6] = {
"今だ!w番ゲットォォォォ!!",
" ̄ ̄ ̄ ̄ ̄∨ ̄ ̄ ̄       (´´",
"    ∧ ∧          (´⌒(´",
"  ⊂(゚Д゚⊂⌒`つ≡≡≡(´⌒;;;≡≡≡",
"        ̄ ̄  (´⌒(´⌒;;",