Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/expect
set timeout 10
spawn telnet mail.example.com 25
expect {
default {exit 2}
"ESMTP Postfix"
}
# helo
send "HELO sender.example.com\n"
@yaasita
yaasita / gist:9948279
Created April 3, 2014 04:28
auto_make_script_log.sh
if [ "$SHLVL" = "1" ] && [ ! -z "$PS1" ] ; then
[ -d ~/oplog/ ] || mkdir ~/oplog
find ~/oplog/ -type f -mtime +60 -delete
script ~/oplog/"typescript_$(date '+%Y%M_%H:%M:%S')"
fi
@yaasita
yaasita / jdprpr.pl
Last active August 29, 2015 13:59
paiza
#!/usr/bin/perl
my (@row,@columns);
{
my $line=<STDIN>;
my ($height,$width)=split(/\s+/,$line);
for (1..$height){
$line=<STDIN>;
chomp $line;
$row[$_-1]=$line;
#!/usr/bin/perl
use File::Temp;
use strict;
use warnings;
# grep
my $temp_grep_log=File::Temp->new(DIR=>"/tmp",SUFFIX=>".tmp");
my $temp_grep_log_name=$temp_grep_log->filename;
system "cat /var/log/syslog | grep '°' > $temp_grep_log_name ";
# make gnuplot data
@yaasita
yaasita / bunkai.pl
Last active August 29, 2015 14:01
blogger2middleman
#!/usr/bin/perl
use strict;
use warnings;
open (FH,"blog-05-10-2014_2.xml") or die $!;
while (<FH>){
if (/^<entry>/){
open (WR,">/tmp/out/${.}.erb") or die $!;
}
if (/^<entry>/../^<\/entry>/){
#!/bin/bash
DISPLAY=:0
function previous {
sleep $1
eval $(xdotool getmouselocation --shell)
echo "$X,$Y"
}
while :;do
#!/bin/bash
set -e
#rbenv
HOME=/home/hogeuser
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
cd ~/middleman
- name: ユーザの作成
- user: name={{ item }} shell=/bin/bash password={{ password }} home=/home/{{ item }}
with_items:
- yamasita
- yamada
- suzuki
- name: パッケージインストール
apt: pkg=tmpreaper state=installed
| インスタンスタイプ | 仮想コア数 | RAM(GiB) | 年契約 | 初期費用 | 月額費用 | 1年間合計費用( 初期費用 + 月額費用 x 12 ) |
|--------------------|------------|-----------|----------|----------|----------|-------------------------------------------|
| m1.medium | 1 | 3.7 | なし | $0 | $91.12 | |
| m1.medium | 1 | 3.7 | 1年 | $270.00 | $27.43 | |
| c3.large | 2 | 3.7 | なし | $0 | $95.51 | |
| c3.large | 2 | 3.7 | 1年 | $357.00 | $36.22 | |
| r3.large | 2 | 15.0 | なし | $0 | $155.53 |
if type percol &>/dev/null
then
[ ! -e ~/.cd_history ] && pwd > ~/.cd_history
function _percol_log_delete {
local log=/tmp/percol-log
if [ -e $log ];then
\rm $log
fi
}
_replace_by_history() {