2012-03-01 聚會手記

上一週 || 下一週

Table of Contents

Mat

如何把 dmesg 的秒數時間換成日期時間顯示
http://linuxaria.com/article/how-to-make-dmesg-timestamp-human-readable?lang=en

#!/usr/bin/perl
 use strict;use warnings;
 my @dmesg_new = ();my $dmesg = "/bin/dmesg";my @dmesg_old = `$dmesg`;my $now = time();my $uptime = `cat /proc/uptime | cut -d"." -f1`;my $t_now = $now - $uptime;
 sub format_time {
 my @time = localtime $_[0];
 $time[4]+=1;    # Adjust Month
 $time[5]+=1900;    # Adjust Year
 return sprintf '%4i-%02i-%02i %02i:%02i:%02i', @time[reverse 0..5];}
 foreach my $line ( @dmesg_old ){
 chomp( $line );
 if( $line =~ m/\[\s*(\d+)\.(\d+)\](.*)/i )
 {
 # now - uptime + sekunden
 my $t_time = format_time( $t_now + $1 );
 push( @dmesg_new , "[$t_time] $3" );
 }}
 print join( "\n", @dmesg_new );print "\n";

wayling

限定 gitk 載入的 log 數,不然開 linux kernel tree 會很久.

gitk --max-count=100 --all -- Makefile

$4

把 Google Chrome Extension 的 Taiwan Radio Tuner 的播放器藏到背景去了
詳情請見 https://github.com/fourdollars/taiwan-radio-tuner/commit/6f1b5d76ac53f6108cfc979c792ab6b7768cebcf

除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License