Skip to content

Instantly share code, notes, and snippets.

View skaji's full-sized avatar

Shoichi Kaji skaji

  • Kanagawa, Japan
  • 09:00 (UTC +09:00)
View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw{say};
use WWW::YouTube::Download;
my $url = shift or die "Specify a video url.\n";
my $client = WWW::YouTube::Download->new;
@skaji
skaji / template.pl
Created November 13, 2012 15:34
Very Simple Template Engine
#!/usr/bin/env perl
use strict;
use warnings;
use subs qw{ template heredoc };
my $doc = heredoc q{
Very simple template engine :)
My name is <% name >. It's <% hour >:<% minute >.
};
#!/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 / gfm_example.pl
Created November 25, 2012 17:52
Perl - GitHub Flavored Markdown
#!/usr/bin/env perl
use strict;
use warnings;
use Markdent::Simple::Document;
my $parser = Markdent::Simple::Document->new;
print $parser->markdown_to_html(
title => 'GFM Example',
dialect => 'GitHub',
use utf8;
use Encode 'encode';
my %accent = (
"Â" => 1,
"\x{C2}" => 1,
"\N{U+C2}" => 1,
"\xC2" => 1,
encode('latin-1', "Â") => 1,
);
@skaji
skaji / gist:4523388
Last active December 11, 2015 01:28
ubuntu apt-get
#!/bin/bash
# curl -kL https://gist.github.com/raw/4523388 | bash
# wget -O - https://gist.github.com/raw/4523388 | bash
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install \
git \
vim-gnome \
@skaji
skaji / yum.sh
Last active December 11, 2015 02:19
#!/bin/bash
# curl -kL https://gist.github.com/raw/4529809 | bash
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install \
git vim-enhanced ncurses-devel wget zsh lsof \
gcc-c++ patch readline readline-devel \
zlib zlib-devel libffi-devel openssl-devel \
@skaji
skaji / screen-build.md
Last active December 11, 2015 02:38
screen build

mac

$ brew install automake autoconf libtool
$ git clone git://git.savannah.gnu.org/screen.git
$ cd screen/src
$ ./autogen.sh
$ ./configure --enable-colors256
$ make
## make sure iTerm2's terminal type is xterm-256color!
@skaji
skaji / do-not-cache.pl
Last active December 11, 2015 06:18
static ファイルをキャッシュさせない
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render_static('image.png');
};
hook before_routes => sub {
my $c = shift;

Note

  • If you don't specify user, then your local user name will be used.
  • If you don't specify auth method, rex try to use several auth methods.
  • If you want to know what is going on, why don't you set -d (debug) option?
  • If you want to turn off INFO message, set $Rex::Logger::silent = 1;

Example

  1. prepare