Skip to content

Instantly share code, notes, and snippets.

View riywo's full-sized avatar
🏈
Go 49ers!

Ryosuke Iwanaga riywo

🏈
Go 49ers!
View GitHub Profile
gem "vagrant", :git => "git://github.com/riywo/vagrant.git", :tag => "v1.0.5.1"
@riywo
riywo / mydiff_default_variables.pl
Created November 16, 2012 00:40
show variablesと今再起動したときのvariablesの差分出せるかなと思ってみたけど挫折した
#!/usr/bin/env perl
use strict;
use warnings;
my $config = fetch_config();
my $variables = fetch_variables(@ARGV);
print_diff($config, $variables);
sub fetch_config {
my @ret = `mysqld --help --verbose 2>/dev/null`;
@riywo
riywo / pub.pl
Created November 14, 2012 06:07
ZMQ pub/sub example with perl
use strict;
use warnings;
use ZMQ;
use ZMQ::Constants qw/ZMQ_PUB/;
use Time::HiRes qw/usleep/;
my $cxt = ZMQ::Context->new();
my $pub = $cxt->socket( ZMQ_PUB );
$pub->bind( "tcp://*:9999" );
--- scripts/mysql_install_db.bak 2012-11-11 22:46:40.868877071 +0000
+++ scripts/mysql_install_db 2012-11-11 22:50:27.449095815 +0000
@@ -634,7 +634,7 @@
foreach my $dir ( $opt->{ldata}, "$opt->{ldata}/mysql", "$opt->{ldata}/test" )
{
mkdir($dir, 0700) unless -d $dir;
- chown($opt->{user}, $dir) if -w "/" and !$opt->{user};
+ system("chown $opt->{user} $dir") if -w "/" and $opt->{user};
}
use strict;
use warnings;
use AnyEvent::Twitter::Stream;
use LWP::UserAgent;
my $config = {
consumer_key => $ENV{CONSUMER_KEY},
consumer_secret => $ENV{CONSUMER_SECRET},
token => $ENV{TOKEN},
token_secret => $ENV{TOKEN_SECRET},
.line[type=join] {display:none;}
.line[type=quit] {display:none;}
.line[type=mode] {display:none;}
.line[type=part] {display:none;}
.line[type=nick] {display:none;}
package inc::MyBuilder;
use strict;
use warnings FATAL => 'all';
use parent qw(Module::Build);
use Fatal qw(open);
use Carp;
use Config;
use Cwd;
use File::Path;
@riywo
riywo / up.pl
Created October 27, 2012 05:01
#!/usr/bin/env perl
use strict;
use warnings;
use Amazon::S3;
my $s3 = Amazon::S3->new({
aws_access_key_id => $ENV{S3_KEY},
aws_secret_access_key => $ENV{S3_SECRET},
retry => 1,
});
@riywo
riywo / gist:3892037
Created October 15, 2012 11:34
daemontoolsでstrace
#!/bin/sh
PID=$$
strace -p $PID -ttT 2>&1 &
exec 2>&1
exec hogehoge
@riywo
riywo / .screenrc
Created October 12, 2012 15:03
screenrcもうちょっとでできそう
escape ^z^z
### Pandemonium
# To use mouse. XT capability is screen specific, not seen in the system
# termcap / terminfo.
termcapinfo * XT
# Z0/Z1 are also screen specific.
termcapinfo xterm*|kterm*|screen* Z0=\E[?3h:Z1=\E[?3l