Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
for fifo in $HOME/.weechat/weechat_fifo_*; do
echo '*/mute layout save' > $fifo
echo '*/mute save weechat' > $fifo
done
BUFFER=$(grep 'default.buffer' $HOME/.weechat/weechat.conf | cut -d'"' -f2 | percol | cut -d';' -f3)
if [ -n "$BUFFER" ]; then
for fifo in $HOME/.weechat/weechat_fifo_*; do
function percol_select_directory() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
local dest=$(_z -r 2>&1 | eval $tac | percol --query "$LBUFFER" | awk '{ print $2 }')
if [ -n "${dest}" ]; then
cd ${dest}
@sugyan
sugyan / notify_status.sh
Last active August 29, 2015 14:00
Get weechat status from tmux command
#!/bin/sh
if [ -n "${VPS_HOST}" ]; then
status=$(ssh ${VPS_HOST} 'curl "https://gist.githubusercontent.com/sugyan/11364796/raw/weechat_status_from_tmux.sh" 2> /dev/null | sh')
if [ -n "${status}" ]; then
echo display notification \"${status}\" with title \"weechat status\" | osascript
fi
fi
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use File::Spec;
my %modules = ();
my %inc = map { $_ => $_ } map { File::Spec->canonpath($_) } @INC;
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use File::Spec;
my %modules = ();
for my $path (grep { $_ ne '.' } @INC) {
find(+{
  • amon2-setup.plでプロジェクト作成
  • carton installする
  • heroku create --buildpack http://github.com/sugyan/heroku-buildpack-perl.git
  • git push
  • template 編集 login
  • Amon2::Auth::Site::Github
  • cpanfile に依存追記、carton install
  • plugin 追加
  • github app 作成
  • config 設定
// logging activated app
var data = {};
S.on('appActivated', function (event, app) {
var name = app.name();
data[name] = data[name] || {
activated_count: 0,
activated_time: 0
};
data[name]['last_activated'] = new Date().getTime();
data[name]['activated_count'] += 1;
#!/usr/bin/env perl
use strict;
use warnings;
sub hoge {
my ($func, @args) = @_;
$func->(@args);
}
hoge(sub {

アメブロ画像保存用ブックマークレット

画像表示の方法が変わったため画像を保存しにくくなったらしい、ということで。

以下をブラウザのブックマークとして保存し、各画像拡大ページで使うと、オリジナルの画像を別タブや別ウィンドウで開けるはずです。

あとは煮るなり焼くなり保存するなり好きにしてください。

PC

@sugyan
sugyan / a.pl
Created October 26, 2012 06:24
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
my $cache = undef;
sub hoge {
return $cache //= do {
my $fuga = piyo();