Skip to content

Instantly share code, notes, and snippets.

View artifactsauce's full-sized avatar

Kenji Akiyama artifactsauce

View GitHub Profile
@artifactsauce
artifactsauce / list_installed_pm.pl
Created November 18, 2010 04:17
List installed perl modules
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use ExtUtils::Installed;
use List::Util;
my %options = ();
GetOptions(
@artifactsauce
artifactsauce / parallel_forkmanager.pl
Created October 20, 2011 07:02
Perl Parallel::ForkManager
#!/usr/bin/env perl
use strict;
use warnings;
use IPC::Shareable;
use Parallel::ForkManager;
my $process_num = 4;
my $handle = tie( my %result, 'IPC::Shareable', undef, { destroy => 1 } );
@artifactsauce
artifactsauce / backup_homedir.sh
Created November 2, 2011 01:02
Backup script for Mac OS X home directory by rsync
#!/bin/sh
CMDNAME=`basename $0`
while getopts n OPT
do
case $OPT in
"n" ) DRY_RUN="--dry-run" ;;
* ) echo "Usage: $CMDNAME [-n]" 1>&2
exit 1 ;;
@artifactsauce
artifactsauce / install_perl.sh
Created May 2, 2012 03:38
Install multiple version of perl into system region with perlbrew
#!/bin/bash
PERL_VERSION="5.14.2"
if [[ `whoami` != "root" ]]; then
echo "[ERROR] Must be done as root."
exit 1
fi
echo "[INFO] Change environment variable HOME." `date`
@artifactsauce
artifactsauce / functions_logger.sh
Last active June 4, 2022 00:53
Bash function file for logger.
# functions
declare -i OK=0
declare -i FAIL=1
[ -n "$LOG_LEVEL" ] || declare -i LOG_LEVEL=3
[ -n "$DATE_FORMAT" ] || DATE_FORMAT="%x %T"
[ -n "$LOG_FILE" ] || LOG_FILE="progress.log"
logger_fatal() {
@artifactsauce
artifactsauce / install.sh
Created December 18, 2012 05:07
Install zabbix version 2.0 package from EPEL to CentOS 6.
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
/usr/bin/yum install -y zabbix20-server-mysql zabbix20-web-mysql mysql-server
/sbin/chkconfig zabbix-server on
/sbin/chkconfig mysqld on
MYSQL_ROOT_PASSWORD='ADMNPASS'
MYSQL_ZBBX_PASSWORD='ZBBXPASS'
/usr/bin/mysqladmin -u root create zabbix --default-character-set=utf8
echo "GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY '${MYSQL_ZBBX_PASSWORD}';FLUSH PRIVILEGES;" | mysql -u root
@artifactsauce
artifactsauce / Gemfile
Last active December 14, 2015 03:09
Gemfile for installing rails 4.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.0.0.beta', github: 'rails/rails'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
@artifactsauce
artifactsauce / moo_sample.pl
Last active December 17, 2015 22:29
An example of Moo.
#!/usr/bin/env perl
package MooSample;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
has 'val_int' => (
is => 'ro',
isa => Int,
@artifactsauce
artifactsauce / setup-gbrowse2.sh
Created September 18, 2013 02:21
Setup script for GBrowse2.
#!/bin/bash
set -e
[ -n $LOG_LEVEL ] || declare -i LOG_LEVEL=3
[ -n $DATE_FORMAT ] || DATE_FORMAT="%x %T"
[ -n $BUILD_DIR ] || BUILD_DIR="/var/tmp/build"
[ -n $PERL_VERSION ] || PERL_VERSION="5.16.3"
function logger_fatal() {
[ $LOG_LEVEL -ge 0 ] || return 1
@artifactsauce
artifactsauce / bootstrap.psgi
Created November 28, 2013 04:22
Plackup a static web site and a web application from one PSGI file for development.
#!/usr/bin/env perl
use Plack::Builder;
use Plack::App::File;
use My::WebApp;
my $app1 = Plack::App::File->new(root => "vendor/root")->to_app;
my $app2 = My::WebApp->psgi_app;
builder {