View default.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ey_aws_key = "retrieved from dna.json" | |
ey_aws_secret = "retrieved from dna.json" | |
bash "add engine yard user to credentials" do | |
user 'deploy' | |
code <<-"EOH" | |
echo '[engineyard]' >> /home/deploy/.aws/credentials | |
echo 'aws_access_key_id=#{ey_aws_key}' >> /home/deploy/.aws/credentials | |
echo 'aws_secret_access_key=#{ey_aws_secret}' >> /home/deploy/.aws/credentials | |
EOH |
View pop3_xoauth2_use_module.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.28; | |
use utf8; | |
use Net::POP3; | |
use Net::POP3::XOAuth2; | |
my $user = 'myaccount@example.com'; | |
my $token = 'ya29.GltdBxoUGp4......'; # retrieve with OAuth2 |
View pop3_xoauth.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.28; | |
use utf8; | |
use Net::POP3; | |
use MIME::Base64; | |
my $user = 'myaccount@example.com'; | |
my $token = 'ya29.GltdBxoUGp4......'; # retrieve with OAuth2 |
View smtp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.python.ambitious-engineer.com/archives/2034 | |
import smtplib | |
from email.mime.text import MIMEText | |
# 送受信先 | |
to_email = "xxxxx@gmail.com" | |
from_email = "xxxxx@s3.spaaqs.ne.jp" | |
# MIMETextを作成 |
View enum_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Response | |
def response_body=(enum) | |
enum.each {|e| puts "res: #{e}" } | |
end | |
end | |
def gen_stream | |
Enumerator.new do |yielder| | |
10.times do |num| | |
puts "stream: #{num}" |
View imap-client.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.18; | |
use Mail::IMAPClient; | |
use File::Slurp; | |
# nohup perl imap-client.pl imap.example.com username password eml_dir 1> importx.log & | |
my $imap_host = $ARGV[0] or die $!; | |
my $user = $ARGV[1] or die $!; | |
my $pass = $ARGV[2] or die $!; | |
my $eml_dir = $ARGV[3] or die $!; |
View parse_release.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.18; | |
use Net::GitHub; | |
use Encode qw/encode_utf8/; | |
use DDP; | |
my @files = glob "release-*"; | |
my %hash = (); | |
for my $f (@files) { | |
my %release = (); |
View github_release.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.18; | |
use Net::GitHub; | |
use Encode qw/encode_utf8/; | |
my $github = Net::GitHub->new( # Net::GitHub::V3 | |
access_token => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
); | |
my $repos = $github->repos; |
View rename_timestamp_part_to_its_dateheader.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use DateTime; | |
use MIME::Parser; | |
my $dir = shift || Cwd::getcwd(); | |
my $count = 0; | |
my @array = (); | |
touch_emls($dir); |
View split_file_evenly.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# split data file as evenly as possible for n-fold cross validation | |
# | |
# Usage: | |
# ./split_file_evenly.pl data_file 10 | |
# | |
# In this case, 10 training and test sets are generated. | |
# |
NewerOlder