How can I make this SQL log file parse become faster

I have a read log file function to get select operation from database log file like this:

def getSelectMySql(log):      with open(log,'r', encoding='utf-8', errors='ignore') as data:         lines   = []         for baris in data:             bariss      = baris.rstrip()             newBaris    = re.sub(r'\t|\n|\r|\s{2,}',' ', bariss)             lines.append(newBaris)             result      = []             buffer      = []             success     = False             for line in lines:                 befSelect   = re.compile(r'^.+?(?=SELECT)')                 date        ="\b(\d{6})(?=\s\d{1,}:\d{2}:\d{2})\b", line)# (\d{1,}:\d{2}:\d{2})                 select      ='\b(SELECT)\b',line)                 parentheses = re.compile('[(){}]')                 if date:                     dat = datetime.datetime.strptime(, '%y%m%d').strftime('%Y-%m-%d')                     if buffer:                         result.append(tuple(buffer))                         buffer.clear()                     buffer.append(dat)                 if line.endswith("important") or line.endswith("'%general_log%'") or line.endswith("puro"):                     success = True if line.endswith("important") else False                 else:                     if success:                         if select and not line.endswith("SELECT"):                             line = re.sub(befSelect,'',line)                             line = re.sub(parentheses,'',line)                             buffer.append(line)             result.append(tuple(buffer))         print('Done\n')         return(result) 

from the data, this function will one save select line after important word. the example of file, like this:

190413  7:55:31 32168376 Query  SHOW variables like '%general_log%'         32168491 Connect    puro@17#.##.#.## on puro         32168491 Query  SELECT * FROM `file` WHERE `identifier` = 'ca28a3b30f893899556749679f8d3066' LIMIT 1         32168491 Quit            32168492 Connect    important@172.2#.#.# on important         32168492 Query  SET NAMES 'utf8'         32168492 Query  SHOW FULL COLUMNS FROM `sys_user`         32168492 Query  SELECT     kcu.constraint_name,     kcu.column_name,     kcu.referenced_table_name,     kcu.referenced_column_name FROM information_schema.referential_constraints AS rc JOIN information_schema.key_column_usage AS kcu ON     (         kcu.constraint_catalog = rc.constraint_catalog OR         (kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)     ) AND     kcu.constraint_schema = rc.constraint_schema AND     kcu.constraint_name = rc.constraint_name WHERE rc.constraint_schema = database() AND kcu.table_schema = database() AND rc.table_name = 'sys_user' AND kcu.table_name = 'sysx_user'         32168492 Query  SELECT * FROM `lecturer_syllabus` WHERE ((`lec_id`='588') AND (`ta`='2016') AND (`sem_ta`='2')) AND (deleted !=1)         32168492 Query  SHOW FULL COLUMNS FROM `lect_year_syllabus` 

The output will be like:

[['190413', '7:55:31', SELECT * FROM `lecturer_syllabus` WHERE ((`lec_id`='588') AND (`ta`='2016') AND (`sem_ta`='2')) AND (deleted !=1)]] 

But as this my first try, I need opinion about what I’ve tried. because my code run slow with larger file.

Why may the public ip address of an amazon ec2-instance become invalid after a certain while?

My ec2-instance works fine usually. But under seemingly random circumstances the public ipv4 address stops working. It does not work with PuTTY nor does my domain work via cloudflare which is pointing toward it.

Every time this problem occurs. I restart the instance. As soon as I restart it and use the newly assigned public ipv4 address in PuTTY and everywhere else, it starts working. I tried using elastic ips but it still does not seem to work.

Besides a rebuild, how can you become native to Toril if you currently aren’t?

So, let’s say you are a prospective 1st level kobold ex-paladin but, alas, you failed to decide to be native to Toril. Besides the rebuild rules present in PHBII, what methods exist that allow you to alter your native status?

Official 3.5 material, including dragon magazine material, and un-updated 3.0 material is okay, but no third party stuff. This question is about what works, not what is balanced (I mean, it’s a question about a facet of Pun-Pun-ness, so hopefully that was already clear). Our criterion for judging whether your history is sufficiently altered or not and to what extent is how unambiguously it qualifies you as a potential target for the Manipulate Form ability of the Sarrukh from Serpent Kingdoms provided you count as a Scaled One.

If I Animate a Corpse made real by the Illusory Reality Ability, does it become an illusion after 1 minute?

To better explain my question, the process follows as such step by step (Assuming the caster is of a level to cast and use all proposed abilities):

• Spellcaster casts Major Image to create a corpse on the ground. • Spellcaster uses Illusory action & a Bonus action to make corpse real. • Spellcaster casts Animate Dead on the corpse.

Now, here’s the proposed question. Illusory Reality only lasts for a minute. Does the creature stay undead or does it become an illusion after one minute is up as I no longer left it as it was?

Please site sources and keep your answer/interpretation RAW.

Can android user become a super user in android?

Is it possible to change the rights of normal user in android to super user?

My requirement is to run the super user code(I want to read a file data from system directory) in a device that has rooted shell but we can not install any super user manager(SuperSu, Magisk etc.) on that device.

I thought of a solution like following:

  1. Install an apk in your device that has UI to call the required function on JNI side to start reading data from the file.
  2. Find the user id of the installed application. I found it in data/system/packages.list file.
  3. Make file owner is this new user id with su shell.
  4. Call the required function in the application that further try to open file.

but this solution is not working. The file is not opened by code and return -8002. The errno is 13.

fd = open("/system/file.txt", O_RDWR | O_LARGEFILE | O_NONBLOCK);     if (fd < 0) {         return -8002;     } 

This is very important for us. I shall be very thankful to all who will help me on this.

Why does my file become a shared library instead of an executable?

I’m trying to build a SPPARKS (Sandia software) executable file following the procedure detailed here:

The issue is that, my final “make” file should end up as an executable, but instead it’s becoming a shared library file. Is there an easy fix for this or some simple way to run a shared library file as an executable? I would appreciate any help!

When inserting notes in Preview app, apostrophes become double-byte characters

Whenever I type a word with an apostrophe inside a note that I insert in a PDF document in Preview (i.e. “I’m”), the apostrophe automatically becomes a double-byte character. I have no idea why this is happening, nor how to fix it. I’m using Mac OS Mojave 10.14.5

Anybody have an answer on how to fix this?

Do Rogues become Tier 3 by removing restrictions on sneak attack?

I enjoy playing Rogues, but they generally have a hard time keeping pace in a 3.5 game and are only Tier 4* per this answer. I’ve personally found one of the biggest hindrances to Rogues is the absurd number of creatures flat out immune to sneak attacks. Indeed of the 12 general types of creatures, 5 are completely immune to sneak attacks, which includes things like Undead and Constructs, which are often walking piles of hit points and usually plentiful in many campaigns. Not to mention the number of creatures of Huge size and greater whom can reasonably be construed as having unreachable vitals by the Rogue under normal conditions.

The ability’s description is as follows:

If a rogue can catch an opponent when he is unable to defend himself effectively from her attack, she can strike a vital spot for extra damage.

The rogue’s attack deals extra damage any time her target would be denied a Dexterity bonus to AC (whether the target actually has a Dexterity bonus or not), or when the rogue flanks her target. This extra damage is 1d6 at 1st level, and it increases by 1d6 every two rogue levels thereafter. Should the rogue score a critical hit with a sneak attack, this extra damage is not multiplied.

Ranged attacks can count as sneak attacks only if the target is within 30 feet.

With a sap (blackjack) or an unarmed strike, a rogue can make a sneak attack that deals nonlethal damage instead of lethal damage. She cannot use a weapon that deals lethal damage to deal nonlethal damage in a sneak attack, not even with the usual -4 penalty.

A rogue can sneak attack only living creatures with discernible anatomies—undead, constructs, oozes, plants, and incorporeal creatures lack vital areas to attack. Any creature that is immune to critical hits is not vulnerable to sneak attacks. The rogue must be able to see the target well enough to pick out a vital spot and must be able to reach such a spot. A rogue cannot sneak attack while striking a creature with concealment or striking the limbs of a creature whose vitals are beyond reach.

With that in mind, if the criteria for sneak attacks was changed to delete the last paragraph, would that move the Rogue from a Tier 4 class to a Tier 3? The definition for each being:

Tier 4

Capable of doing one thing quite well, but often useless when encounters require other areas of expertise, or capable of doing many things to a reasonable degree of competance without truly shining. Rarely has any abilities that can outright handle an encounter unless that encounter plays directly to the class’s main strength. DMs may sometimes need to work to make sure Tier 4s can contribue to an encounter, as their abilities may sometimes leave them useless. Won’t outshine anyone except Tier 6s except in specific circumstances that play to their strengths. Cannot compete effectively with Tier 1s that are played well.

Tier 3

Capable of doing one thing quite well, while still being useful when that one thing is inappropriate, or capable of doing all things, but not as well as classes that specialize in that area. Occasionally has a mechanical ability that can solve an encounter, but this is relatively rare and easy to deal with. Challenging such a character takes some thought from the DM, but isn’t too difficult. Will outshine any Tier 5s in the party much of the time.

I suspect that this has been attempted before at someone’s table before. A good answer would discuss that experience and whether the player felt that Rogues ascended to Tier 3 in usefulness.

*Full discussion on tiers provided here.