Skip to content

Instantly share code, notes, and snippets.

View skaji's full-sized avatar

Shoichi Kaji skaji

  • Kanagawa, Japan
  • 12:56 (UTC +09:00)
View GitHub Profile
spawn sudo -H -u git bundle exec rake gitlab:setup RAILS_ENV=production
rake aborted!
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `new'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2_connection'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/acti

ubuntu

/etc/networking/interfaces

auto eth0
iface eth0 inet static
    address 192.168.0.17
    netmask 255.255.255.0
    network 192.168.0.0
 broadcast 192.168.0.255
#!/usr/bin/env perl
use strict;
use warnings FATAL => "all";
# http://perldoc.perl.org/functions/seek.html
# tail -f
my $file = shift or die;
open my $fh, "<", $file or die "open $file: $!";

ubuntu

keyboard 再設定。

> sudo dpkg-reconfigure keyboard-configuration

#!/bin/sh
cat <<EOF > out
this is here doc.
EOF
# シングル or ダブルクオートで囲むと変数展開しない。
cat <<"EOF" > out
path is $PATH
EOF
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.014;
use Net::DNS::Nameserver;
use Net::DNS::RR;
my $handler = sub {
my ($qname, $qclass, $qtype, @opt) = @_;
@skaji
skaji / dns-server-prefork.pl
Created March 15, 2014 17:34
just a prototype
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
require Net::DNS::Nameserver::Prefork;
my $app = sub {
my ($qname, $qclass, $qtype, $peerhost, $query, $conn) = @_;
my ($rcode, @ans, @auth, @add);
...;
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use feature qw{say};
use subs qw{ heredoc };
use Mac::iTunes;
use App::Daemon qw{daemonize};
use Getopt::Long (
':config', # configuration start
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode qw{ encode decode };
use WWW::YouTube::Download;
use Term::ReadKey ();
use List::Util qw(first);
use File::Temp ();
use File::Spec ();
@skaji
skaji / color.pl
Last active August 29, 2015 13:57
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
{
no strict 'refs';
my @color = qw(black red green yellow blue magenta cyan white);
for (0..$#color) {
my ($c, $n) = ($color[$_], 30 + $_);
*$c = sub { -t *STDOUT ? "\e[1;${n}m@_\e[m" : "@_" };