Say Perl

Worldwide Perl Blogging

Totally
311 feeds,
9627 posts.

httpd-here: everywhere set up a web server

23 May, 14:56, by gugod, machine translated from Twi

Remember IO:: All of A Tiny Web Server you:

 perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 ? "./$1 |" : $1) if /^GET \/(.*) / })' 

Before writing a number of front-end Javascript / HTML / CSS program, are first the machine httpd (Apache or Nginx) of a VirtualHost's DocumentRoot set home directory to a subdirectory, then there test to run Mac is ~/Sites in this directory. This may be fast and convenient, but the project changed a long time to come and go Daoshi top switch trouble. Especially now write a front-end interface are also measured iPhone / iPad, arbitrary institution's local hostname on to break up. (Really is a ubiquitous than 127.0.0.1 ah.)

For convenience, I use Plack built Plack:: App:: Directory to set up impromptu Web server:

 plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root => ".")->to_app;' 

Simple packaging into httpd-here the executable file.

Thus, when the need to test:

 > cd ~/src/project-foo > httpd-here Twiggy: Accepting connections at http://0.0.0.0:5000/ 

To provide automatically generated due to index page that way all devices can use this temporary site to non-line testing. Finished, press Ctrl-C interrupt will be OK, do not write any settings for the new project is very convenient.


httpd-here: everywhere set up a web server

23 May, 14:56, by gugod, machine translated from Twi

Remember IO:: All of A Tiny Web Server you:

 perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 ? "./$1 |" : $1) if /^GET \/(.*) / })' 

Before writing a number of front-end Javascript / HTML / CSS program, are first the machine httpd (Apache or Nginx) of a VirtualHost's DocumentRoot set home directory to a subdirectory, then there test to run Mac is ~/Sites in this directory. This may be fast and convenient, but the project changed a long time to come and go Daoshi top switch trouble. Especially now write a front-end interface are also measured iPhone / iPad, arbitrary institution's local hostname on to break up. (Really is a ubiquitous than 127.0.0.1 ah.)

For convenience, I use Plack built Plack:: App:: Directory to set up impromptu Web server:

 plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root => ".")->to_app;' 

Simple packaging into httpd-here the executable file.

Thus, when the need to test:

 > cd ~/src/project-foo > httpd-here Twiggy: Accepting connections at http://0.0.0.0:5000/ 

To provide automatically generated due to index page that way all devices can use this temporary site to non-line testing. Finished, press Ctrl-C interrupt will be OK, do not write any settings for the new project is very convenient.

perlbrew PATH in Emacs.app

20 May, 00:20, by gugod, machine translated from Twi

Emacs.app on Mac is not launched with the same $PATH set from bashrc/cshrc, which means perlbrew cannot work without some special treatments. One common problem is that cperl-perldoc will not be able to find the module document correctly. If you’re experiencing it, keep reading.

To get cperl-perldoc working, set the environment variable PATH inside .emacs:


(load "cl-seq")

;;; Prepend perlbrew paths to exec-path
(mapc (lambda (x) (add-to-list 'exec-path x))
 (mapcar (lambda (x) (concat (getenv "HOME") x))
         (list "/perl5/perlbrew/bin" "/perl5/perlbrew/perls/current/bin")))

;;; set PATH to be the same as exec-path, clobber the old PATH value.
(setenv "PATH"
        (reduce
         (lambda (a b) (concatenate 'string a ":" b))
         exec-path))

cperl-perldoc should correctly invoke the perldoc program in PATH from now.

To verify that exec-path setting is also working, try eval (C-x C-e) this sexp in *scratch* buffer:

(call-process "perl" nil t nil "-E" "say $^X")

The full path of current perl executable should be appeared in the *scratch* buffer.


perlbrew PATH in Emacs.app

20 May, 00:20, by gugod, machine translated from Twi

Emacs.app on Mac is not launched with the same $PATH set from bashrc/cshrc, which means perlbrew cannot work without some special treatments. One common problem is that cperl-perldoc will not be able to find the module document correctly. If you’re experiencing it, keep reading.

To get cperl-perldoc working, set the environment variable PATH inside .emacs:


(load "cl-seq")

;;; Prepend perlbrew paths to exec-path
(mapc (lambda (x) (add-to-list 'exec-path x))
 (mapcar (lambda (x) (concat (getenv "HOME") x))
         (list "/perl5/perlbrew/bin" "/perl5/perlbrew/perls/current/bin")))

;;; set PATH to be the same as exec-path, clobber the old PATH value.
(setenv "PATH"
        (reduce
         (lambda (a b) (concatenate 'string a ":" b))
         exec-path))

cperl-perldoc should correctly invoke the perldoc program in PATH from now.

To verify that exec-path setting is also working, try eval (C-x C-e) this sexp in *scratch* buffer:

(call-process "perl" nil t nil "-E" "say $^X")

The full path of current perl executable should be appeared in the *scratch* buffer.

perlbrew problem with Net::DNS

13 May, 16:02, by gugod, machine translated from Twi

If you're on Mac, using perlbrew and try to install Net::DNS, you might see it fail with this error message:

ld: in netdns.a, archive has no table of contents
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Net/DNS/DNS.bundle] Error 1

I'm not sure what causes it yet but I'm guessing that I need to play with some LD_LIBRARY_* variables since perlbrew installs perl to $HOME. Before it's fixed, heres' an work-around:

ranlib netdns.a

Execute that command after you see the ld error. After that, proceed the installation with:

make
make test && make install

You should see the tests are passing just fine.


perlbrew problem with Net::DNS

13 May, 16:02, by gugod, machine translated from Twi

If you're on Mac, using perlbrew and try to install Net::DNS, you might see it fail with this error message:

ld: in netdns.a, archive has no table of contents
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Net/DNS/DNS.bundle] Error 1

I'm not sure what causes it yet but I'm guessing that I need to play with some LD_LIBRARY_* variables since perlbrew installs perl to $HOME. Before it's fixed, heres' an work-around:

ranlib netdns.a

Execute that command after you see the ld error. After that, proceed the installation with:

make
make test && make install

You should see the tests are passing just fine.

Install all used modules at once

6 May, 17:06, by gugod, machine translated from Twi

Ever since perlbrew was made useful, switching among different versions of perl makes it painful to re-install the required modules over and over. That's why I wrote this module-used program to rescue me.

The usage of module-used is heavily inspired by tokuhirum++'s cpan-outdated program:

cd /to/my/awesome-project
module-used

That gives you a list of module names which are found to be used in some source files under current directory. It can then be piped to xargs cpan -i to perform bulk module installation:

module-used | xargs cpan -i
module-used | xargs cpanm

Although cpanm --installdeps is doing basically the same thing here, this program is also helpful for module authors to get a list of names for their Makefile.PL or Build.PL, which might not be there in the first place if the current project is not planed to be uploaded to CPAN.

The module-used program itself uses Module::ExtractUse and List::MoreUtils , install them first, and the the program should be ready to run.


Install all used modules at once

6 May, 17:06, by gugod, machine translated from Twi

Ever since perlbrew was made useful, switching among different versions of perl makes it painful to re-install the required modules over and over. That's why I wrote this module-used program to rescue me.

The usage of module-used is heavily inspired by tokuhirum++'s cpan-outdated program:

cd /to/my/awesome-project
module-used

That gives you a list of module names which are found to be used in some source files under current directory. It can then be piped to xargs cpan -i to perform bulk module installation:

module-used | xargs cpan -i
module-used | xargs cpanm

Although cpanm --installdeps is doing basically the same thing here, this program is also helpful for module authors to get a list of names for their Makefile.PL or Build.PL, which might not be there in the first place if the current project is not planed to be uploaded to CPAN.

The module-used program itself uses Module::ExtractUse and List::MoreUtils , install them first, and the the program should be ready to run.

Links for 2010-04-30 [del.icio.us]

4 May, 00:05, machine translated from Twi

Links for 2010-04-06 [del.icio.us]

4 May, 00:05, machine translated from Twi

Links for 2010-04-05 [del.icio.us]

4 May, 00:05, machine translated from Twi

Links for 2010-03-21 [del.icio.us]

4 May, 00:05, machine translated from Twi

Links for 2010-03-19 [del.icio.us]

4 May, 00:05, machine translated from Twi

Links for 2010-03-17 [del.icio.us]

4 May, 00:05, machine translated from Twi

OSDC / RubyConf TW 2010 review

26 April, 16:10, by gugod, machine translated from Twi

Conclusion: This year the venue was so high, and after the site has not identified how the power to ah ...

Hackers loose in the frog coffee. First complete the perlbrew 0.05 version. Support from the checkout to compile git out a new perl. So, git out perl program has been useful for people who do not have to take time to download the tarball of perl.

Later, Kawasaki-san with his 3D slide into the practice of using CSS3 (using semi-transparent color and text-shadow), and the system made bookmarklet. Do not use the Fool's Day version of Google Chrome, open any website can become 3D! Please refer to 3D-bookmarklet.html . Test 3D effect is really dizzy. In the 3D TV Hot ago, Eye Clinic of the business may will be fine.

Full trial of the obra of the iPad.

Participated in the half RubyConf met a number of Takahashi-san ruby players outside of Japan. But really now playing to the Ruby on Rails people are still talking about the practical aspect of the topic (depends on what money).

However, if only in a language of its own capacity constraints which, while narrowing of ideas, it would be a pity.

Less is more.

More is more.


OSDC / RubyConf TW 2010 review

26 April, 16:10, by gugod, machine translated from Twi

Conclusion: This year the venue was so high, and after the site has not identified how the power to ah ...

Hackers loose in the frog coffee. First complete the perlbrew 0.05 version. Support from the checkout to compile git out a new perl. Therefore, the program has been useful in perl git out the people would not take the time to download the tarball of perl.

Later, Kawasaki-san with his 3D slide into the practice of using CSS3 (using semi-transparent color and text-shadow), and the system made bookmarklet. Do not use the Fool's Day version of Google Chrome, open any website can become 3D! Please refer to 3D-bookmarklet.html . Test 3D effect is really dizzy. In the 3D TV Hot ago, Eye Clinic of the business may will be fine.

Full trial of the obra of the iPad.

Participated in the half RubyConf met a number of Takahashi-san ruby players outside of Japan. But really now playing to the Ruby on Rails people are still talking about the practical aspect of the topic (depends on what money).

However, if only in a language of its own capacity constraints which, while narrowing of ideas, it would be a pity.

Less is more.

More is more.

Links for 2010-03-24 [del.icio.us]

27 March, 15:15, machine translated from Twi

Tomorrow

26 March, 16:54, by c9s, machine translated from Twi

hypergit.vim - GitStatus / GitStash Buffer

25 March, 01:31, by c9s, machine translated from Twi



This is directly in Git Status / Stash List the check diff, delete, revert, add operational files Buffer. Hypergit.vim now added to the inside.

Just directly under: GitStaus or GitStash command can be.

http://github.com/c9s/hypergit.vim

perlbrew: $HOME perl installation made easy

21 March, 05:49, by gugod, machine translated from Twi

Respond to miyagawa’s cpanminus project, I bootstrap the perlbrew, it is a program that automate the the builds of perl distributions into your $HOME.

This program lets you install perl like this:

perlbrew install perl-5.10.1
perlbrew install perl-5.11.5

And then you can switch between versions at any time

perlbrew switch perl-5.11.5
perlbrew switch perl-5.10.1

Ever installed perl has their own site lib.

perlbrew can probably help you if you install perl to $HOME, like me.

If you are familiar with Ruby tools, perlbrew plays similar roles like rvm, but different. It does not install different perl from different vendor, because that diversity has been merged into one and the only perl distribution - the one that you find on cpan. (Well, there are still different vendors who distribute their own perl, but I doubt it can be easily handled by perlbrew. We’ll see.)

Also perl has its own mechanism to have multiple installations of different versions on the same machine. If you are already do it that way, you probably do not need this program to help you anything.

This project was just started and need more hacking power. Maybe it’ll be on my TODO list for the OSDC.tw post-conference hackathon.


perlbrew: $HOME perl installation made easy

21 March, 05:49, by gugod, machine translated from Twi

Respond to miyagawa’s cpanminus project, I bootstrap the perlbrew, it is a program that automate the the builds of perl distributions into your $HOME.

This program lets you install perl like this:

perlbrew install perl-5.10.1
perlbrew install perl-5.11.5

And then you can switch between versions at any time

perlbrew switch perl-5.11.5
perlbrew switch perl-5.10.1

Ever installed perl has their own site lib.

perlbrew can probably help you if you install perl to $HOME, like me.

If you are familiar with Ruby tools, perlbrew plays similar roles like rvm, but different. It does not install different perl from different vendor, because that diversity has been merged into one and the only perl distribution - the one that you find on cpan. (Well, there are still different vendors who distribute their own perl, but I doubt it can be easily handled by perlbrew. We’ll see.)

Also perl has its own mechanism to have multiple installations of different versions on the same machine. If you are already do it that way, you probably do not need this program to help you anything.

This project was just started and need more hacking power. Maybe it’ll be on my TODO list for the OSDC.tw post-conference hackathon.

Vim-Makefile

20 March, 19:01, by c9s, machine translated from Twi

A lightweight non-dependency Makefile for install, uninstall, bundle, distribute Vim plugin scripts.

DESCRIPTION

I wrote this because I saw people using Rakefile to install plugin scripts. but some people dont have rake on their system. I even wrote my own perl module (VIM::Packager) to do something like this, but it has too many dependencies and need to setup cpan shell (before we have cpanminus)...

GNU make is ths most commonly used utility, which is almost in every system, so it basically doesn't have other dependencies.

This Makefile provides features to install,uninstall,bundle,distribute vim plugin. it's simple , quick and lightweight. And you can also use vim-makefile to generate vimball distribution. (More details of vimball, please see :help vimball section)

And I also appended a util vim-makefile to fetch the latest Makefile. you can simply run vim-makefile to generate the Makefile.

Check out on github.

Vim-Makefile

20 March, 18:58, by c9s, machine translated from Twi

Lightweight and non-dependent Makefile, for the installation, anti-installation, packaging, publishing Vim plug-ins.

Introduction

I wrote this Makefile is because I have seen some people use the Rakefile to install Vim plug-in script, but some people do not rake or a ruby in their machines, or do not know how to use. Before I even use Perl wrote VIM:: Pacakger to do something like this, but the dependencies are too many modules, and require time to set up tools.

GNU-make is the most widely used in various types of systems tools in all of the computers are certainly looking into his. (Windows except)

This provides the Makefile to install, uninstall, packaging, publishing Vim plug-in features, is quite simple, fast, easy to use. You also can also be used to generate Vimball format, the release of files, or use tar package.

(On Vimball additional information, please refer to: help vimball section)

In addition, I have also attached a script vim-makefile to grab the latest from github The Makefile to initialize plug-in Makefile.

View full content:
http://github.com/c9s/vim-makefile/blob/master/README-zh.md

A longer version of Perl development visualization

18 March, 04:10, by gugod, machine translated from Twi

Some people asked so here's a longer version of that film: http://blip.tv/file/get/Gugod-TheDevelopmentOfPerl651.mp4 . Thanks to blip.tv. It's about 20 minutes and it might be a bit boring just staring at it. Go pop some corns first.


A longer version of Perl development visualization

18 March, 04:10, by gugod, machine translated from Twi

Some people asked so here's a longer version of that film: http://blip.tv/file/get/Gugod-TheDevelopmentOfPerl651.mp4 . Thanks to blip.tv. It's about 20 minutes and it might be a bit boring just staring at it. Go pop some corns first.

Vim - git rebase helper

16 March, 15:05, by c9s, machine translated from Twi

This helper script is for `git rebase --interactive` command:

Anyway, I read the source material all the whole chop

16 March, 12:30, by gugod, machine translated from Twi

In a flash, RSS / Atom is also popular in these many years, often when both want to start NNW Haohao De classification of the source material, so that each item properly placed in a properly named folder, but you really want to start hands, word-processing brain regions, there are numerous "difficult" words is magnified into 72 words. So be at ease on the first distraction, pretend that was not true, so his stay there for many years, chaos has already set the source material Overrun. Well, extremes meet, and death and new life, after the addition, subtraction superior .


Jifty on Plack

14 March, 18:19, by gugod, machine translated from Twi

This does not hit CPAN yet but @clkao has announced on jifty-devel mailing list  that the Plack support is integrated into the jifty master.

The newly generated jifty app will create an 'app.psgi' by default, which contains the following code:

use Jifty;
Jifty->new;
Jifty->handler->psgi_app;

This essentially returns a Plack app. From there you can run:

plackup

to start a server with plack. Which also means you can run:

starman

to launch the pre-forking Starman web sever, and:

twiggy

to use the AnyEvent-based, lightweight Twiggy server.

The best part, is that you can use 'cpanm' to install everything real quick with cpanm:

cpanm Starman
cpanm Twiggy
git clone http://github.com/bestpractical/jifty
cd jifty
cpanm .

Pretty cool.


Jifty on Plack

14 March, 18:19, by gugod, machine translated from Twi

This does not hit CPAN yet but @clkao has announced on jifty-devel mailing list  that the Plack support is integrated into the jifty master.

The newly generated jifty app will create an 'app.psgi' by default, which contains the following code:

use Jifty;
Jifty->new;
Jifty->handler->psgi_app;

This essentially returns a Plack app. From there you can run:

plackup

to start a server with plack. Which also means you can run:

starman

to launch the pre-forking Starman web sever, and:

twiggy

to use the AnyEvent-based, lightweight Twiggy server.

The best part, is that you can use 'cpanm' to install everything real quick with cpanm:

cpanm Starman
cpanm Twiggy
git clone http://github.com/bestpractical/jifty
cd jifty
cpanm .

Pretty cool.

Dong Building, renamed the National Taiwan University 4 +1

11 March, 10:38, by gugod, machine translated from Twi

4 +1 Building Building renamed the National Taiwan University concerning , although on the website of the alumni bulletin, but I really learned in the opposition's. Many people think the name changed just like the memory of the past to deny the same, the memory of the underclassmen who will not match up with their own.

I also do not agree that they changed the building name, the new name is easy to play but want to trade the old name, is very far-fetched. But you really want to think about it, I was not so extreme opposition. Now the school scene, and then back to the time difference between the students very much, they have built a new case in the hair. Even after a few years into the campus and visit again, and memories of the past to meet, I'm afraid too thin a.

Personal opinion: As long as good possessor of azalea, palm, trees, flowers and trees to keep the campus Jing luxuriant as ever, how to build the buildings how to change its name to set it by them.


Perl development history in 4 minutes

8 March, 05:19, by gugod, machine translated from Twi

I took a little CPU time last weekend and finished this silent movie. Featuring all perl rock stars, I present you: Perl development history in 4 minutes (link to Youtube).

Enjoy watching how fascinating they are.


Perl development history in 4 minutes

8 March, 05:19, by gugod, machine translated from Twi

I took a little CPU time last weekend and finished this silent movie. Featuring all perl rock stars, I present you: Perl development history in 4 minutes (link to Youtube).

Enjoy watching how fascinating they are.

Why use CPANMinus

27 February, 14:24, by c9s, machine translated from Twi

because the original CPAN Shell startup time slow, cumbersome and too much information, too much Prompt, and for newcomers, too many default settings to be done, but the novice just need to prepare a complete development as quickly as possible environment in which to write Perl code only! CPAN Shell, however, because of too old, the code is already quite difficult to maintain, organize, it has not been a good amendment. Not to mention CPANPLUS, CPANPLUS itself dependent on a bunch of modules is simply redundant, for starters, installed CPANPLUS even takes 10 minutes!

So, Miyagawa wrote cpanminus, this module CPAN Shell very fast start-up time and does not dependent on other modules, such as cumbersome Moose ...:-P

cpanminus only need you have a C Compiler, Module:: Build, ExtUtils:: MakeMaker (Perl is built), or even directly embedded HTTP:: LIte module.

Therefore, there is no need to install cpanminus spend more than three seconds of time! Think you have the time to upgrade CPAN or CPANPLUS how painful! !

Again, often without root privileges from users, how to install CPAN modules, this issue has been long plagued everyone's! And nor perfect solution.

As long as a non-Root user performs cpanm install the module, the module will be loaded automatically into the home directory under ~ / perl5, nor do they need another set on their own!

Installation is quite simple:

cd ~/bin
wget http://xrl.us/cpanm
chmod +x cpanm


This may be because cpanm just a single executable file!

Usage:

cpanm Module
cpanm MIYAGAWA/Plack-1.0000.tar.gz
cpanm ~/mydists/MyCompany-Framework-1.0.tar.gz
cpanm http://example.com/MyModule-0.1.tar.gz
cpanm http://github.com/miyagawa/Tatsumaki/tarball/master
cpanm --interactive Task::Kensho


You can also go to get the latest version on github! @ miyagawa ROCKS!!

http://github.com/miyagawa/cpanminus

cpanm: Fast lightweight install the CPAN module program

26 February, 14:23, by gugod, machine translated from Twi

cpanm is a very quick little tool, without any settings, you can begin to install cpan module. Compared to the full CPAN.pm Shell is concerned, it has a little bit inadequate, but after a few measured found to support those who are relatively independent part of the pain.

Install it

cpanm is a single executable file, as long as the download down into the $PATH where you can use:

 curl -LO http://bit.ly/cpanm chmod +x cpanm sudo cp cpanm /usr/local/bin 

Usage

Use the form used is as follows:

 cpanm Jifty cpanm MIYAGAWA/Plack-0.99_05.tar.gz cpanm http://backpan.perl.org/authors/id/L/LD/LDS/CGI.pm-3.20.tar.gz cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz 

Parameters can be accessed by module name, with a version number of the Tarball file name, Tarball URL, or Tarball on this machine path. Adjustable options are five:

 -v, --verbose : 輸出完整的資訊-f, --force : 強制安裝。就算測試過程有錯誤也照樣安裝-n, --notest : 不跑測試-S, --sudo : 安裝時以sudo 指令進行--installdeps : 僅安裝依存的模組 

That was all. Whether the machine is new or temporary to be installing a CPAN modules are very easy to use.


cpanm: fast, lightweight CPAN module installer

26 February, 14:23, by gugod, machine translated from Twi

cpanm is a very quick little tool, without any set, you can begin installing cpan module. Than complete CPAN.pm Shell is concerned, it has a little bit inadequate, but after a few measured found that those who are relatively independent part of raising the pain.

Install it

cpanm is a single executable file, just download down into the $PATH where you can use:

 curl -LO http://bit.ly/cpanm chmod +x cpanm sudo cp cpanm /usr/local/bin 

Usage

Common use of the form:

 cpanm Jifty cpanm MIYAGAWA/Plack-0.99_05.tar.gz cpanm http://backpan.perl.org/authors/id/L/LD/LDS/CGI.pm-3.20.tar.gz cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz 

Parameters can be accessed by module name, version number of the Tarball file with a name, Tarball URL, or Tarball path in the machine. Adjustable options are five:

 -v, --verbose : 輸出完整的資訊-f, --force : 強制安裝。就算測試過程有錯誤也照樣安裝-n, --notest : 不跑測試-S, --sudo : 安裝時以sudo 指令進行--installdeps : 僅安裝依存的模組 

That was all. Whether the machine is new or temporary to install a CPAN module, very easy to use.

Ssh key management using keychain

18 February, 07:12, by c9s, machine translated from Twi

generally to make use of remote ssh login ssh key to do it, you'll need to use ssh-agent. Most use the following command to start the ssh-agent

$ echo `ssh-agent` > .agent

This will be ssh-agent environment variables such as the pid so the output to. Agent files.

Then use:

$ source .agent

Will. Agent environment variables come loaded.

Next, re-use ssh-add command to load the private key:

$ ssh-add path/to/key1

In ~ / .ssh / config, add

Host yourhost.com
IdentityFile path/to/key1

To tell ssh to use path/to/key1 the private key, but remember to key1.pub (public key) added to the remote's .ssh / authorized_keys file.

Described earlier, the command to use ssh-agent management problems often encountered, so have to write your own script checks whether there are existing ssh-agent is running and so complicated like the matter. The keychain was a script to help you address these issues.

Under the ubuntu install keychain:

$ sudo apt-get install keychain

To macports:

$ sudo port install keychain



Use very simple way, without their launch an ssh-agent, you can just call the private key loaded keychain command:

$ keychain path/to/key1

Keychain will then inform the ssh-agent environment variables, file location, available to use different shell script, just added to the file path. Bashrc or. Zshrc ...

$ source ~/.keychain/....blah

Can. This way when opening a new environment, you do not go check the ssh-agent pid, or ssh-agent, the direct use of existing, and if not, then launch a new ssh-agent and ssh-update agent's environment variables.

Here is what I used to load the key in the script:



Since I will be public key, private key stored in ~ / .ssh / keys in the script to automatically load private key.

Billionth birth of seconds

17 February, 14:28, by gugod, machine translated from Twi

In addition to approaching 30th birthday, I would also soon be 1 billion seconds so old. Because it was very curious about what it would be one day, so I pinch mean ^ H ^ H wrote a program to count on.

1 billion seconds, then the number of conversion all day, or about 11,574.074 days, count the words of adults, or about 31.7097 years. However, according to each person born in different years, this 31-plus years in the leap year will be a slight plus or minus a few. Therefore, the date is not easy to figure out right away.

Ruby Code with this brief can be immediately calculated, at 12:00:00 on January 1, 1980 was born, his second billionth birth date falls on September 9, 2011, but almost zero during the first will be completely different:

 DateTime.parse("1980-01-01") + 10.0**9/86400 

The same end of the Javascript expression is not a small figure who looks a bit, that is much larger:

 new Date((new Date(1980, 0, 1)).getTime() + 1000000000000) 

Lisp, these years are still training people to quickly calculate the number of right parentheses capacity:

 (current-time-string (time-add (encode-time 0 0 0 1 1 1980) (seconds-to-time 1000000000))) 

Python, are the small class sizes, very cute

 datetime.datetime(1980,1,1) + datetime.timedelta(seconds = 10**9) 

Finally, definitely not a small Perl:

 DateTime->new(year => 1980, month => 1, day => 1)->add(seconds => 10**9) 

Special guests HTML5:

 <!-- XXX: Not implemented --> 

(Laughs)


The birth of the tenth million seconds

17 February, 14:28, by gugod, machine translated from Twi

In addition to the third birthday approaching, I would also soon be 1 billion seconds so old. Because it is very curious what will be one day, so I pinch that ^ H ^ H wrote a program to work it out.

1 billion seconds, then convert the number all day, or about 11,574.074 days, count the words of adults, or about 31.7097 years. However, each born in different years, which 31 years in the leap year will be slightly the number of addition and subtraction. Therefore not easy to figure out the date immediately.

Ruby Code with this brief can figure out right away, at 0:00:00 on January 1, 1980 born, his 10th 100 000 000 seconds, the date of birth falls on September 9, 2011, is almost zero during the first will be completely different:

 DateTime.parse("1980-01-01") + 10.0**9/86400 

The same purpose Javascript expression is not a small figure who looks a bit, is much larger:

 new Date((new Date(1980, 0, 1)).getTime() + 1000000000000) 

Lisp, these years are still training people to quickly calculate the right amount of capacity parentheses:

 (current-time-string (time-add (encode-time 0 0 0 1 1 1980) (seconds-to-time 1000000000))) 

Python, are small class sizes, very cute

 datetime.datetime(1980,1,1) + datetime.timedelta(seconds = 10**9) 

Finally, never less Perl:

 DateTime->new(year => 1980, month => 1, day => 1)->add(seconds => 10**9) 

Special guests HTML5:

 <!-- XXX: Not implemented --> 

(Laughs)

A shiny link hover effect.

9 February, 01:08, by gugod, machine translated from Twi

This is why you use Safari.

I recorded a short video demo of this effect: Watch it on youtube.

CSS Code:

@-webkit-keyframes shiny {
    from { }
    to   { text-shadow: 0 0 10px #77f; }
}
a:hover {
     -webkit-animation-name: shiny;
     -webkit-animation-duration: 0.7s;
     -webkit-animation-iteration-count: infinite;
     -webkit-animation-direction: alternate;
     -webkit-animation-timing-function: ease-in-out;
}

Enjoy.


LESS.app For Mac OS X - LESS CSS app

6 February, 16:36, by gugod, machine translated from Twi

LESS CSS used to OSX Automatic Compiler. See http://incident57.com/less/ . Reviews page in a column is pure comedy.


HTML5 Video small complaint

6 February, 06:00, by gugod, machine translated from Twi

html5 video biggest problem is: the browser may put fixed. Web App Programming mystery thing was: all of the browser before blindly stamped on the madness, and then discuss the foundation is not deep, the bottleneck is too small. Conclusion is that the world will take gold to upgrade hardware to meet their own needs, and read Web pages over the past decade the evolution of specifications and Reconstruction.


Readibility: Fat provoking Bookmarklet

6 February, 03:46, by gugod, machine translated from Twi

Readability is a Bookmarklet gadget, he can do is look at the current page, the chaff; (very surprisingly) find the important part, then the most classic, comfortable way to show them.

Like that, this page UDN news, the original seems very messy:

udn.png

However, once Readability after treatment, people can immediately read the news article:

udn-readable.png

Awesome. Very amazing, very beautiful, very people reflect on: Whichever, web Why put so many things?

Echoes the upper subtraction theme, readability of this Bookmarklet gadget inspired me so true to something. Page also how the design? Simple as on.


Upgraded to MTOS 5

5 February, 18:01, by gugod, machine translated from Twi

It's done. I chose the Pico theme after seeing and inspired by the Readability Bookmarklet earlier today.

The upgrade is easy, however, I need to vim the Markdown.pl a bit to get around to this "Wide character in subroutine entry" bug that block all publishing.

Took a little while to understand the relations between a "Website" and a "Blog". I think I like MTOS5 so far. The new admin UI looks sharp. Maybe it'll make me write more. I do hope so.


Upgraded to MTOS 5

5 February, 18:01, by gugod, machine translated from Twi

It's done. I chose the Pico theme after seeing and inspired by the Readability Bookmarklet earlier today.

The upgrade is easy, however, I need to vim the Markdown.pl a bit to get around to this "Wide character in subroutine entry" bug that block all publishing.

Took a little while to understand the relations between a "Website" and a "Blog". I think I like MTOS5 so far. The new admin UI looks sharp. Maybe it'll make me write more. I do hope so.

Tip: Install a CPAN module directly from URL

2 February, 04:38, by gugod, machine translated from Twi

I wonder how many people know this. With CPANPLUS, you can install any cpan module directly from its tarball URL:

cpanp -i http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Plack-0.99_02.tar.gz

Very handy, indeed.


Tip: Install a CPAN module directly from URL

2 February, 04:38, by gugod, machine translated from Twi

I wonder how many people know this. With CPANPLUS, you can install any cpan module directly from its tarball URL:

cpanp -i http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Plack-0.99_02.tar.gz

Very handy, indeed.

Vim - glob application

1 February, 19:50, by c9s, machine translated from Twi

temporary need for a catalog of all the files into the img tag, so temporary in the vim command line directly under the written such a thing to deal with:


Order a bit:

Vim - TreeMenu.vim

1 February, 01:31, by c9s, machine translated from Twi

This is a TreeMenu class for VimL. so that you can render a tree menu in a buffer.

Synopsis:


and you can also hook a method to after_render when each time the menu buffer is updated , just like what i do in hypergit.vim - I need to redraw git help message when the buffer is updated by tree menu.


Menu Source:

Capify The Pony

1 February, 00:55, by gugod, machine translated from Twi

I managed to deploy Jifty apps with Capistrano.

Capistrano is a tool for deploying Rails apps, however, with some small tweaks, it can be used to deploy Jifty apps.

Install it:

gem install capistrano

The first step is to capify your Jifty app:

cd /path/to/AwesomeJiftyApp
mkdir config
capify .

It generates a config/deploy.rb file, which we modify it to satisfy what we need. Here’s an example that deploys to example.com:


set :application, "AwesomeJiftyApp"
set :repository,  "git@git.example.com/awesome.git"

set :deploy_to, "/home/apps/awesome"

set :scm, :git
set :use_sudo, false
set :deploy_via, :remote_cache

role :app, "example.com"
role :web, "example.com"
role :db,  "example.com", :primary => true

namespace :deploy do
  desc "Create database.yml and asset packages for production"
  task :after_update_code, :roles => [:web] do
    run "cp -r #{shared_path}/etc/* #{latest_release}/etc/"
  end

  desc "Restart the app is undefined to be a no-op."
  task :restart, :roles => :app, :except => { :no_release => true } do
  end

  task :migrate, :roles => :app do
    run "cd #{latest_release}; bin/jifty schema --setup"
  end

  # Un-define some rails-specific tasks.
  [:start, :stop, :finalize_update].each do |t|
    desc "#{t} task is a no-op."
    task t, :roles => :app do ; end
  end
end

It’s pure ruby code. For those Perl programmers who wonder what the do...end means, it mean a code ref like sub { ... }.

Run the setup task. This will create the required directories on the remote host example.com:

cap deploy:setup

In my case, I put site_config.yml, which contains the database username/password setting, to /home/apps/awesome/shared/etc, and copy it over to the latest app dir every time.

Then, run a “cold” start, this will prepare the directory structure and run database migration:

cap deploy:cold

Afterwards, you just git push your code and then run:

cap deploy

Then the latest code will be re-deployed.

The example deploy.rb undefined several rails-specific steps. Including the restart of the server. That will certainly depe

Capify The Pony

1 February, 00:55, by gugod, machine translated from Twi

I managed to deploy Jifty apps with Capistrano.

Capistrano is a tool for deploying Rails apps, however, with some small tweaks, it can be used to deploy Jifty apps.

Install it:

gem install capistrano

The first step is to capify your Jifty app:

cd /path/to/AwesomeJiftyApp
mkdir config
capify .

It generates a config/deploy.rb file, which we modify it to satisfy what we need. Here’s an example that deploys to example.com:


set :application, "AwesomeJiftyApp"
set :repository,  "git@git.example.com/awesome.git"

set :deploy_to, "/home/apps/awesome"

set :scm, :git
set :use_sudo, false
set :deploy_via, :remote_cache

role :app, "example.com"
role :web, "example.com"
role :db,  "example.com", :primary => true

namespace :deploy do
  desc "Create database.yml and asset packages for production"
  task :after_update_code, :roles => [:web] do
    run "cp -r #{shared_path}/etc/* #{latest_release}/etc/"
  end

  desc "Restart the app is undefined to be a no-op."
  task :restart, :roles => :app, :except => { :no_release => true } do
  end

  task :migrate, :roles => :app do
    run "cd #{latest_release}; bin/jifty schema --setup"
  end

  # Un-define some rails-specific tasks.
  [:start, :stop, :finalize_update].each do |t|
    desc "#{t} task is a no-op."
    task t, :roles => :app do ; end
  end
end

It’s pure ruby code. For those Perl programmers who wonder what the do...end means, it mean a code ref like sub { ... }.

Run the setup task. This will create the required directories on the remote host example.com:

cap deploy:setup

In my case, I put site_config.yml, which contains the database username/password setting, to /home/apps/awesome/shared/etc, and copy it over to the latest app dir every time.

Then, run a “cold” start, this will prepare the directory structure and run database migration:

cap deploy:cold

Afterwards, you just git push your code and then run:

cap deploy

Then the latest code will be re-deployed.

The example deploy.rb undefined several rails-specific steps. Including the restart of the server. That will certainly depends on how you config it. You might be able to put:

run “sudo apache2ctl restart”

… in there. If you config your app to be instantiated with apache2 + fastcgi.

Definitely check the Capistrano documentation for more tweaks in deploy.rb setting. This is a practically useful tool, and it shouldn’t be difficult to play with.