I added this to ~/.bashrc to provide colorized tail:  tailc () {   tail $@ | ccze }   And I can run it as so: tailc -f -n 10 foo/log.txt  But I can't use it on a privileged file:  sudo tailc -f -n 10 /var/log/syslog   Error:     bash: tailc: command not found   I know I can do it like this: sudo bash -i -c '...' but I want to know if I can run it without that more complicated syntax. What can I do to be able to just type sudo tailc ...?  BTW, I added that function to /root/.bashrc as well, but that didn't help either.
I have a script that does a number of different things, most of which do not require any special privileges. However, one specific section, which I have contained within a function, needs root privileges.  I don't wish to require the entire script to run as root, and I want to be able to call this function, with root privileges, from within the script. Prompting for a password if necessary isn't an issue since it is mostly interactive anyway. However, when I try to use sudo functionx, I get:  sudo: functionx: command not found   As I expected, export didn't make a difference. I'd like to be able to execute the function directly in the script rather than breaking it out and executing it as a separate script for a number of reasons.  Is there some way I can make my function "visible" to sudo without extracting it, finding the appropriate directory, and then executing it as a stand-alone script?  The function is about a page long itself and contains multiple strings, some double-quoted and some single-quoted. It is also dependent upon a menu function defined elsewhere in the main script.  I would only expect someone with sudo ANY to be able to run the function, as one of the things it does is change passwords.
Auto-expand TAB character in code formatting Related:       Note that this question, while related, is not the same as the ones linked.  In many cases, when people put code into questions or answers, they copy/paste the code from their editor.  If their editor is using tab characters, the formatting will be broken after the post is submitted.  For example, if a code is indented using TAB characters, then one TAB character in the beginning of a line will be treated as one level of indent and align with the left edge of the code, effectively indenting equally to 4 spaces.  However in the post editor it looks indented twice - the same as 8 spaces.  I often edit other people's posts to improve code formatting and I find this TAB issue being the biggest annoyance.  Most of the times (I think) on SO, we use 4 spaces to format/indent the code.  I think it would be an easy thing to auto-expand TAB characters inside &lt;code&gt; blocks by replacing them with 4 spaces when the post is submitted. Suppose $f:X\rightarrow Y$ is a surjection and you want to show that there exists $g:Y\rightarrow X$ s.t. $f\circ g=\mathrm{id}_Y$. You need the AC to show this.  However, suppose $f$ is a injection and you want show there is $g$ s.t. $g\circ f=\mathrm{id}_X$. Then, according to my textbook, you don't need the AC to show this.  This is counterintuitive to me, because it's like you need a special axiom to claim that an infinite product of big sets is nonempty, while you don't need one to claim that an infinite product of singleton sets is nonempty, which seems smaller than the former.  So why don't you need the AC to show the latter?  EDIT: $X$ should be nonempty.  EDIT 2: I realized (after asking this) that my question mostly concerns whether the AC is needed to say that an infinite product of finite sets is nonempty, and why. “Screen overlay detected” dialog? Turned off everything, doesn't work I started receiving the “Screen overlay detected” dialog when trying to change apps settings.  Tried to turn off all "draw over other apps" as it says here - , first without system and then with, but it still doesn't work.  Then, I restored apps to original settings and it just made a bigger mess, dialog continue appearing. Any way to go back to previous settings???  Thanks! Quitting a job in the US on a work visa, going to Canada and re-entering on a tourist visa (ESTA waiver) I have been working in the USA on an E-3 visa and intend to return home to Australia, but I want to travel around the US before I do so. I am under the impression that after leaving my current company, I will have 10 days to leave the country.   Will I be able to go into Mexico or Canada and re-enter with an ESTA waiver as a tourist? I'm having a problem with author display for a statute - the author is 'City and County of San Francisco' but the output (using the apalike.bst style file provided by Elsevier) gives the author as 'City and San Francisco', missing the 'County' in the authorname.  Any suggestions? Effect on loading a DC motor - load torque Could someone give a (detailed) explanation (perhaps with formulas) of how the load (torque) affects the armature current of a DC motor (separately excited or shunt or series)?  As the load torque increases the speed of the motor decreases, and assuming the terminal voltage stays constant, the EMF will become lower and thus the armature current will increase.  But could someone give me the formula that shows the relation between load torque and armature current?  Is it something like:   \$T_\text{developed} = T_\text{shaft} + T_\text{friction windage} + T_\text{load}\$ ,   where \$T_\text{developed} = K \, \text{flux}_\text{pole} \,I_\text{armature}\$ ?  But then you have  \$P_d = P_s + P_{f_w} + P_l   \$  where \$P_d = K \,\text{flux}_\text{pole}\, I_\text{armature}  \,\omega_m\$  In the last formula you can't see that as the increase due to \$P_\text{load }\$ the armature current increases because maybe someone can say the speed \$\omega_m\$ increases.  And how come at no-load the armature current and thus the torque developed is zero? Is it really zero, or do I have to assume there is some current flowing?  Could also explain me the principle of torque developed. Because at no load, the shaft torque is equal to torque developed, right? Run bash script at login stored in the home folder? When I try to load a LaunchAgent plist from launchctl I can't find out how to run a script in the home directory.  My code is:  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt;     &lt;key&gt;ProgramArguments&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;bash&lt;/string&gt;         &lt;string&gt;~/script.sh&lt;/string&gt;     &lt;/array&gt;     &lt;key&gt;RunAtLoad&lt;/key&gt;     &lt;true/&gt;     &lt;key&gt;Label&lt;/key&gt;     &lt;string&gt;com.tyilo.test&lt;/string&gt; &lt;/dict&gt; &lt;/plist&gt;   I have tried both with and without bash and also replacing ~ with $HOME. I have also tried using bash -c without it working.  The error code is:   `com.tyilo.test: bash: ~/script.sh: No such file or directory` What is the longest additional time ever used in Europe's top five leagues? Please mention the details of the match. Moment of inertia of a cylinder about its base I've tried to find the moment of inertia of a cylinder rotating about an axis parallel to its base (i.e about the 'End diameter') as one can see  . But when I checked my results with different references ,I've found that it's incorrect!.I need a help to figure out where I did it wrong. since $$I=\int\limits x^2.dm$$ $$dm = \rho.dv$$ where $$dv= r.d\theta . dr .dh$$ &amp; $$\rho=\frac{M}{\pi R^2 H}$$ $M$:cylinder total mass. $H$:total height of cylinder. $R$:the radius of the cylinder. The distance of each infinitesimal element from the axis of rotation would be : $$\sqrt{r^2+h^2}$$ Therfore, $$I= \frac{2M}{ R^2 H}\int\limits_{0}^{R} \int\limits_{0}^{H}\, r(r^2+h^2)dh\,dr$$ and this gives a result of : $$\frac{M~H^2}{3}+\frac{M~R^2}{2}$$ Which is obviously wrong since the second term should be multiplied by a factor of $1/2$. Is the differentiation operator an open mapping? Consider the vector spaces $C([0, 1])$ and $C^1([0, 1])$ with norm, \begin{align*} \displaystyle \|f\|_\infty=\sup_{x\in [0, 1]}|f(x)|, \end{align*} and let $T:C^1([0, 1])\to C([0, 1])$ the operator given by, \begin{align*} \displaystyle Tf=f'. \end{align*} Is $T$ defined this way an open mapping? If it's, how to prove it? Prove or disprove that $f(x) = \sin x/x$ is uniformly continuous over the interval $(0,1)$? I am thinking of $\lim_{x \to 0} \ {f(x)} = 1$ but I am confused as $x=0$ is not in the domain and also I want to write an $\epsilon$-$\delta$ proof. So any help is much appreciated!  Thanks! Summer in Saint Helena The Winter Bash site is located at http://winterba.sh/.  Only one problem:   . Saint Helena is in the Southern Hemisphere. It's Summer in Saint Helena.   So shouldn't it be the Summer Bash? Don't forget our Aussie/Kiwi/South African/Southern Brazilian/Argentine/Uruguayan/Zimbabwean/Swazi/Tokelauan/Tuvaluan/Pitcairn Islander/ friends! Difference estimate & confidence intervals for $\chi^2$ test between 2 proportions I am using a chi-sq test between two proportions (). I am using this over the z-test for proportions because I do not think my data is normal.   My question is how do I get the difference (shift) estimate &amp; confidence intervals for this test.   For example,     Data1: 193/252=.77   Data2: 154/227=.68   P-value=.032 (I used the formula in the link above. I will also add my exact code below)  Shift Estimate: I assume its the difference between proportions, ie .77-.68=.09. Is this correct?   Confidence Interval: ??????????????????  Code for generating P-value (matlab):   % Pooled estimate of proportion  p0 = (n1+n2) / (N1+N2); % Expected counts under H0 (null hypothesis)  n10 = N1 * p0;  n20 = N2 * p0; % Chi-square test, by hand  observed = [n1 N1-n1 n2 N2-n2];  expected = [n10 N1-n10 n20 N2-n20];  chi2stat = sum((observed-expected).^2 ./ expected);  p = 1 - chi2cdf(chi2stat,1);  H=0; if(p&lt;.05), H=1; end "is a field and used like a type" error php loop through json array Scoring matrices (BLOSUM & PAM) in BLAST and other sequence-comparison programs The  states that:      The scores are created by comparing the word in the list in step 2* with all the 3-letter words. By using the scoring matrix (substitution matrix) to score the comparison of each residue pair, there are 203 possible match scores for a 3-letter word. For example, the score obtained by comparing PQG with PEG and PQA is 15 and 12, respectively with the BLOSUM62 weighting scheme.   I do not understand how they got a score of 15 for PQG v. PEG. What is a scoring matrix, how is it computed, and how is it used?      Step 2 on that page is Make a k-letter word list of the query sequence: “Take k=3 for example, we list the words of length 3 in the query protein sequence (k is usually 11 for a DNA sequence) sequentially, until the last letter of the query sequence is included”. How do you read CSS rule values with JavaScript? Find all the numbers $n$ such that $\frac{4n-5}{60-12n}$ can't be reduced. Find all the numbers $n$ such that $\frac{4n-5}{60-12n}$ can't be reduced.   Attempt:  $$\gcd(4n-5,60-12n)=(4n-5,-8n+55)=(4n-5,-4n+50)=(4n-5,45)$$  $$n=1: (4-5,45)=1\quad \checkmark\\ n=2: (3,45)=3\quad \times\\ n=3: (7,45)=1\quad \checkmark\\ n=4: (11,45)=1\quad \checkmark\\ n=5: (15,45)=15\quad \times\\ n=6: (19,45)=1\quad \checkmark\\ n=7: (23,45)=1\quad \checkmark\\ n=8: (27,45)=9\quad \times\\ \vdots$$ So the answer is that it can't be reduced for $n=1,3,4,6,7,..$ i.e  $$\bigg\{n\bigg|n\notin \begin{cases}a_1=2\\a_n=a_{n-1}+3\end{cases}\bigg\}$$  I want to verify that my solution is correct Prove $\sup(f+g) \le \sup f + \sup g$ Suppose $D$ is a nonempty bounded subset of reals. Let $f:D \to \mathbb R$ and $g:D \to \mathbb R$. Define $(f+g)(x)=f(x)+g(x)$. Prove $\sup(f+g)(D) \le \sup f(D) + \sup g(D)$ (also prove that $\sup (f+g)$ exists).   I understand why this is the case, just not how to prove it. Left side is pretty much $\sup  (f(x)+g(x))$ and right side is $\sup (f(x) + g(y))$ for $x,\,y \in D$. Basically $f+g$ has to use the same variable and $f(D)+g(D)$ use different ones. But I don't know how to go about proving this.     The second part of the question is to find a specific example where strict inequality holds.    Let $D=\{a,b\}$ and $f: a \to 1,\, b\to 0, \,g: a \to 0,\, b\to 1$. $\sup f(D) = 1,\, \sup g(D) = 1,\, \sup f(D) + \sup g(D) = 2.$ $\sup (f+g)(D) = 1$ (if we choose a, $f+g = 1+0,\, b,\, f+g=0+1$). Asynchronous shell exec in PHP