Skip to content

Instantly share code, notes, and snippets.

View artifactsauce's full-sized avatar

Kenji Akiyama artifactsauce

View GitHub Profile
@artifactsauce
artifactsauce / deploy.rb
Last active December 11, 2017 17:03
Notification tasks for Slack with Capistrano.
namespace :notify do
namespace :update do
task :start do
_send_message("[\`#{fetch(:application)}\`] Deployment has started.")
end
task :finish do
_send_message("[\`#{fetch(:application)}\`] Deployment has finished. :ok_woman:\n> #{fetch(:commit_message)}")
end
end
@artifactsauce
artifactsauce / post-update
Last active March 9, 2017 04:34
gitの共有リポジトリにpushしたらSlackとChatworkにメッセージを通知する ref: http://qiita.com/artifactsauce/items/242c71428fa85307c182
#!/usr/bin/env perl
package MyApp::Notifier::Base;
use warnings;
use LWP::UserAgent;
sub new {
my $class = shift;
my $self = { @_ };
#!/usr/bin/env bash
set -eu
RUBY_VERSION="2.1.2"
if ! which -s brew; then
echo "[ERROR] Homebrew is required."
exit 1
fi
#!/bin/bash
set -eu
API_TOKEN="<CHANGE_THIS>"
ROOM_ID="<CHANGE_THIS>"
REPOS=$(basename $(pwd))
REPOS=${REPOS%.*}
@artifactsauce
artifactsauce / conv-ja2utf8.pl
Created January 7, 2014 06:57
Convert from a Japanese encoding file to UTF-8.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode;
use Encode::Guess qw/shift-jis euc-jp 7bit-jis/;
use Perl6::Slurp;
use Path::Class;
@artifactsauce
artifactsauce / conv-pg_dump-tsv.pl
Last active March 13, 2024 13:17
Convert from a pg_dump data file to TSV files for LOAD DATA INFILE.
#!/usr/bin/env perl
use strict;
use warnings;
use Path::Class;
use FindBin;
my $output_dir = dir($FindBin::Bin,"data");
$output_dir->is_dir or die "[ERROR] $output_dir is not a directory.";
@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 {
@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 / 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 / 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