Skip to content

Instantly share code, notes, and snippets.

public void send(String senderMail, String senderName, List<String> receiverList, String subject, String content)
{
LOGGER.info("send");
Properties props = System.getProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "email-smtp.us-west-2.amazonaws.com"); // 到https://console.aws.amazon.com/ses/下的SMTP Setting可以你的主機位址
props.put("mail.smtp.port", 25);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
#https://www.packtpub.com/books/content/introduction-logging-tomcat-7
#http://tomcat.apache.org/tomcat-7.0-doc/logging.html
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler # 有 File 和 Console 兩個 Handler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
<servlet>
<servlet-name>QuartzInitializer</servlet-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>wait-on-shutdown</param-name>
<param-value>true</param-value>
org.quartz.threadPool.threadCount=2 # 用2個 Thread
org.quartz.plugin.jobInitializer.class=org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin # 用 XML(quartz_data.xml) 設定排程工作
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data
xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd"
version="1.8">
<schedule>
<job>
mkdir /path/to/your/jenkins_vm_project
cd /path/to/your/jeknins_vm_project
# 查看你抓下來的 box
vagrant box list
# centos64_x86_64 是我替 CentOS6.4 64 取的 box 名稱
vagrant init centos64_x86_64
# vagrant init 會自動產生 Vagranfile
#!/usr/local/bin/python
import time
import RPi.GPIO as GPIO
# http://coopermaa2nd.blogspot.tw/2010/12/arduino-lab6.html
B0 = 31
C1 = 33
CS1 = 35
D1 = 37
#!/usr/local/bin/python
import commands
def getIpList():
ipList = commands.getoutput("/sbin/ifconfig | grep -i \"inet\" | grep -iv \"inet6\" | " +
"awk {'print $2'} | sed -ne 's/addr\:/ /p'")
return ipList
import smtplib
// The BlogId of a test blog.
String TEST_BLOG_ID = "8070105920543249955";
// Configure the Java API Client for Installed Native App
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
// set up authorization code flow
AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(
BearerToken.authorizationHeaderAccessMethod(),