-
UNIX
perl feed.pl | peco -null | xargs -r chromium-browser
-
Windows
perl feed.pl | peco --null | xargs -r start
UNIX
perl feed.pl | peco -null | xargs -r chromium-browser
Windows
perl feed.pl | peco --null | xargs -r start
$ ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S="\xf0\x9f\x8d\xa3";a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.01}' |
//- templated by jade | |
svg(width=640 height=480 style="background-color:grey;") | |
circle( | |
cx=30 cy=30 | |
r=25 | |
stroke="grey" stroke-width=1 | |
fill="wheat") | |
rect( | |
width=50 height=50 | |
x=60 y=10 |
#!/bin/sh | |
set -eu | |
FILENAME=`basename $0` | |
SCRIPT_PID="/tmp/${FILENAME%.*}.pid" | |
if [ -f $SCRIPT_PID ]; then | |
PID=`cat $SCRIPT_PID ` | |
if (ps -e | awk '{print $1}' | grep $PID >/dev/null); then | |
echo "${0##*/}: exist another instance" 1>&2 | |
exit 1 |
#!/bin/sh | |
# chkconfig: 345 99 1 | |
# description: sample | |
# processname: sample | |
start() { | |
echo -n "starting sample:" | |
/usr/local/sbin/sample | |
return 0 | |
} |
#!/bin/bash | |
foo=${1:-hoge} | |
echo $foo #$1がなかったらhogeをデフォルト値としてfooに代入する | |
#var自身にデフォルト値としてhogeを代入としたいので以下のように書きたい | |
${var:=hoge} #このままでは、hogeが展開されてしまって、hogeなんてコマンドはないとシェル怒られる | |
echo "1:$var" | |
var= |
こんな指針がいいのかなー 2013 夏 ver.
.NET の「例外のデザインのガイドライン」にもこう書いてある。
<?php | |
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php'; | |
function retry($f, $delay = 10, $retries = 3) | |
{ | |
try { | |
return $f(); | |
} catch (Exception $e) { | |
if ($retries > 0) { | |
sleep($delay); |
# open current directory in Finder | |
alias f='open .' | |
# cd to the path of the front Finder window | |
cdf() { | |
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` | |
if [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Finder window found' >&2 |