Skip to content

Instantly share code, notes, and snippets.

View spicasax's full-sized avatar
👓

Cynthia Sadler spicasax

👓
View GitHub Profile
''' quick example showing how to attach a pdf to multipart messages
and then send them from SES via boto
'''
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import boto
# get flashcard file
if (@ARGV > 0) {
$f=$ARGV[0];
} else {
die "Usage: perl flashcard.pl <pipedelimitedflashcardfile>\n";
}
# read flashcard file
open (FILE,"$f");
@lines=<FILE>;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris molestie eros. Nullam at justo quis eros feugiat blandit. Nulla sed nunc. Sed quis purus. Suspendisse potenti. Phasellus in ante. Cras ut nibh. Nulla ut odio. Phasellus mauris. In eu lectus eu dolor egestas tempus. Integer aliquam. Phasellus accumsan. Sed iaculis lacus in lacus. Aliquam erat volutpat. Vestibulum nulla enim, pharetra sit amet, tincidunt et, bibendum id, magna. Aenean elit. Vivamus nunc.
rm -f 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps.ear';
rm -r -f 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps_expanded/';
mkdir -p 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps_expanded/';
cd 'c:/ibm/WebSphere/profiles/wp_profile/temp';
'C:\\ibm\\WebSphere\\profiles\\wp_profile\\bin/wsadmin.bat' -username phurnace -password password -c '$AdminApp export wps c:/ibm/WebSphere/profiles/wp_profile/temp/wps.ear';
'C:\\ibm\\WebSphere\\profiles\\wp_profile\\bin/EARExpander.bat' -ear c:/ibm/WebSphere/profiles/wp_profile/temp/wps.ear -operationDir 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps_expanded' -operation expand;
rm -f 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps.ear';
cd 'c:/ibm/WebSphere/profiles/wp_profile/temp/wps_expanded/wps.war';
rm -r -f './skins/html/qaThinSkin';
infile = ARGV[0]
outfile = ""
open(infile) {|f|
f.to_a.each do |line|
outfile += line.gsub(/\s+/, ",").chop + "\n"
end
}
puts outfile
new_file = File.new(filename, "w+")
new_file.puts new_script
new_file.close
system "dos2unix #{filename}"
new_script.gsub(/\r\n/, "\n") #convert DOS line feeds to unix format
new_file = File.new(filename, "w+")
new_file.puts new_script
new_file.close
require 'find'
argv = ARGV.empty? ? %w{.} : ARGV
file_counts = Hash.new(0)
files = Array.new
Find.find(*argv) do |fullname|
# looking for image files only
next unless fullname =~ /\.(JPEG|JPG|GIF|MOV)$/i
file = File.basename(fullname).downcase