Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

seunggabi seunggabi

🎯
Focusing
Block or report user

Report or block seunggabi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FileUtils.java
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);
View makeFile.java
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;
View sendEmail.java
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 {
View byte2string.py
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')
@seunggabi
seunggabi / check_restart_tomcat.py
Last active Nov 4, 2019
check_restart_tomcat.py
View check_restart_tomcat.py
# 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/"
View checkHttpStatus.py
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()
@seunggabi
seunggabi / [Github] close change files by jQuery
Created Sep 17, 2019
[Github] close change files by jQuery
View [Github] close change files by jQuery
$$('.btn-octicon.js-details-target').forEach(a => a.click())
View reverseString.js
function reverse(str) {
return str.split('').reserve().join('')
}
View getDateTime.java
public static String getDateTime() {
Date from = new Date();
SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return transFormat.format(from);
}
@seunggabi
seunggabi / decimalToHex.java
Last active Sep 17, 2019
decimalToHex.java
View decimalToHex.java
public static String decimalToHex(int decimal, Integer length) {
return String.format("%0"+length+"x", decimal);
}
You can’t perform that action at this time.