From 91f0a00c5542ed89495f008d115e92705c3a01ca Mon Sep 17 00:00:00 2001 From: Witcher01 Date: Tue, 14 Apr 2020 17:34:57 +0200 Subject: [PATCH 1/3] code cleanup cleaned up code in 'KumarAsshole.java'. fixed confusing indentation and newlines for better readability. --- java/KumarAsshole.java | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/java/KumarAsshole.java b/java/KumarAsshole.java index 24471c9e..cbbd97a4 100644 --- a/java/KumarAsshole.java +++ b/java/KumarAsshole.java @@ -1,4 +1,3 @@ - import java.io.File; import java.io.FileInputStream; import java.util.*; @@ -19,15 +18,13 @@ public static void main(String[] args) { public void read() { Properties props = new Properties(); - - //modify below properties to your details - String host = "smtp.gmail.com"; - String username = "yourmailaddress@example.com goes here"; - String password = "your password goes here "; - String Kumar_mail = "the mail address to be replied to !"; - - try { + //modify below properties to your details + String host = "smtp.gmail.com"; + String username = "yourmailaddress@example.com goes here"; + String password = "your password goes here "; + String Kumar_mail = "the mail address to be replied to !"; + try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); @@ -39,21 +36,16 @@ public void read() { Message messages[] = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)); for (int i = 0; i < messages.length; i++) { - if (messages[i].getFrom()[0].toString().contains(Kumar_mail)) { - String bodytext = null; Object content = messages[i].getContent(); if (content instanceof String) { bodytext = (String) content; - } else if (content instanceof Multipart) { - Multipart mp = (Multipart) content; BodyPart bp = mp.getBodyPart(mp.getCount() - 1); bodytext = (String) bp.getContent(); - } Pattern pattern = Pattern.compile("sorry|help|wrong", Pattern.CASE_INSENSITIVE); @@ -61,7 +53,6 @@ public void read() { // check all occurance if (matcher.find()) { - Properties props1 = new Properties(); Address[] tomail; @@ -73,23 +64,18 @@ public void read() { msg.setSubject("Database fixes"); msg.setText("No problem. I've fixed it. \n\n Please be careful next time."); Transport t = null; - t = session.getTransport("smtps"); - t.connect(host, username, password); - t.sendMessage(msg, msg.getAllRecipients()); - - + t = session.getTransport("smtps"); + t.connect(host, username, password); + t.sendMessage(msg, msg.getAllRecipients()); + } + } } - - } - } inbox.close(true); store.close(); - }catch(Exception e) - { - + } catch(Exception e) { e.printStackTrace(); } } -} \ No newline at end of file +} From 2be4a07f740ab4cf2ba35518cf00781dec6b3d98 Mon Sep 17 00:00:00 2001 From: ONEmoertime <51313428+ONEmoertime@users.noreply.github.com> Date: Thu, 20 Aug 2020 15:57:58 +0800 Subject: [PATCH 2/3] Update README.zh-CN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Chinese, the translation of "he" is "他" instead of "她",“她”is"she" --- README.zh-CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 3d07a559..b3f184d6 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,7 +2,7 @@ 根据 *[真实故事](https://www.jitbit.com/alexblog/249-now-thats-what-i-call-a-hacker/)* 改编: -> xxx: 是这样的,我们的构建工程师离职去了另外一家公司,这货基本算是生活在终端里。 你知道么,这人热爱Vim,用Dot作图,甚至用MarkDown来写维基帖子...,如果有什么事情要花上他超过90秒,她一定会整个脚本来让这件事变得“自动化”。 +> xxx: 是这样的,我们的构建工程师离职去了另外一家公司,这货基本算是生活在终端里。 你知道么,这人热爱Vim,用Dot作图,甚至用MarkDown来写维基帖子...,如果有什么事情要花上他超过90秒,他一定会整个脚本来让这件事变得“自动化”。 > xxx: 我们现在坐在他的工位上,看着他留下来的这些,呃,“遗产”? @@ -56,4 +56,4 @@ GMAIL_PASSWORD=password ------ -代码的使用遵循WTFPL(Do What The Fuck You Want To Public License)协议。 \ No newline at end of file +代码的使用遵循WTFPL(Do What The Fuck You Want To Public License)协议。 From f394120de09a86e59ee2eebb455f1205c2c0b188 Mon Sep 17 00:00:00 2001 From: Ash Jindal Date: Mon, 18 Jul 2022 09:48:28 +0100 Subject: [PATCH 3/3] Add archive.org link for the dead bash.im link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b46c69d..00d6deef 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ story](https://www.jitbit.com/alexblog/249-now-thats-what-i-call-a-hacker/)_: > xxx: holy sh*t I'm keeping those -Original: http://bash.im/quote/436725 (in Russian) +Original: http://bash.im/quote/436725 (in Russian) (Archive.org [link](https://web.archive.org/web/20210226092253/http://bash.im/quote/436725)) Pull requests with other implementations (Python, Perl, Shell, etc) are welcome. ## Usage