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 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
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
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 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
// 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
# reference: https://wkdtjsgur100.github.io/selenium-change-ip/ | |
# brew install geckodriver | |
# brew install tor | |
# brew services restart tor | |
from selenium import webdriver | |
from bs4 import BeautifulSoup | |
import os | |
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
import time | |
import os | |
class IO: | |
def __init__(self, path, name): | |
if not os.path.exists(path): | |
os.makedirs(path) | |
self.path = path |
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
import re | |
class StringUtils: | |
@staticmethod | |
def removeTags(contents): | |
contents = re.sub("<\/?[\w\?\"\.\=\-\ ]*>", "", contents) | |
contents = re.sub("(\\n\\t*\\n)+", "\\n", contents) | |
return contents |
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
#!/bin/sh | |
# ./print_access_log.sh keyword 20200302 server_list.txt | |
### server_list.txt ### | |
a | |
b | |
c | |
####################### | |
keyword=$1 |