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
// if(DateUtils.isNowBetweenTime("2019-11-26 15:20:00.0", "2019-12-25 23:59:59.0")) { | |
public static boolean isNowBetweenTime(String start, String end) { | |
long now = System.currentTimeMillis(); | |
long startTime = (start == null) ? now : Timestamp.valueOf(start).getTime(); | |
long endTime = (end == null) ? now : Timestamp.valueOf(end).getTime(); | |
return startTime <= now && now <= endTime; | |
} |
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
public class FileUtils { | |
public static void joinFiles(File destination, File[] sources) throws IOException { | |
OutputStream output = null; | |
try { | |
output = createAppendableStream(destination); | |
for (File source : sources) { | |
appendFile(output, source); | |
} | |
} finally { | |
IOUtils.closeQuietly(output); |
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
private static File makeFile(List<String> lines) throws IOException { | |
File temp = File.createTempFile(FILENAME, ""); | |
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(temp, true), StandardCharsets.UTF_8)); | |
for(String line : lines) { | |
bw.write(line + "\n"); | |
} | |
bw.close(); | |
return temp; |
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
public static void sendEmail(String emailString, String subject, String message, File file) { | |
String[] emails = StringUtils.split(emailString, ","); | |
Properties props = System.getProperties(); | |
props.setProperty("mail.smtp.host", "localhost"); | |
Session session = Session.getDefaultInstance(props); | |
MimeMessage msg = new MimeMessage(session); | |
try { |
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
from pyparsing import unicode | |
from bs4 import BeautifulSoup | |
path = "" | |
binary_filename = "binary.txt" | |
i = open(binary_filename, "rb") | |
input = i.read() | |
input = unicode(input, errors='ignore') |
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
# 5 * * * * python3 /home1/irteam/check_restart_tomcat.py | |
from urllib.request import urlopen | |
from urllib.error import HTTPError | |
import os | |
import time | |
URL = "" | |
TOMCAT_PATH = "/home/user/apps/tomcat/bin/" |
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
from urllib.request import urlopen | |
from urllib.error import HTTPError | |
def checkHttpStatus(URL): | |
try: | |
res = urlopen(URL) | |
return res.status | |
except HTTPError as e: | |
code = e.getcode() |
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
$$('.btn-octicon.js-details-target').forEach(a => a.click()) | |
$$('.js-reviewed-checkbox:checked').forEach(a => a.click()) |
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
function reverse(str) { | |
return str.split('').reserve().join('') | |
} |
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
public static String getDateTime() { | |
Date from = new Date(); | |
SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
return transFormat.format(from); | |
} |