Where do I put cleanup code in a Flask application?
Python Flask shutdown event handler
Get OS-level system information Video editing. Audio and Video strip have different length I am trying to recall the name of a story I read when I was fairly young (maybe 20 years ago, but not sure how old the story is).    What I remember: A man acquires a set of creatures that he keeps in his house, I think in an aquarium.  They evolve over time, quickly, and think of him as their benevolent god. They build statues in his likeness.   Then, I believe some sort of accident happens, and the statues they build become a little less benevolent, which bothers him.  This pattern continues on with his cruelty increasing and their depiction of him becoming more cruel. How to: Unlimited Bash/shell history? Is there a way to define an unlimited history in Bash ? I have some pages on my site that I want to keep search engines away from, so I disallowed them in my robots.txt file like this: User-Agent: * Disallow: /email  Yet I recently noticed that Google still sometimes returns links to those pages in their search results.  Why does this happen, and how can I stop it? Background: Several years ago, I made a simple web site for a club a relative of mine was involved in.  They wanted to have e-mail links on their pages, so, to try and keep those e-mail addresses from ending up on too many spam lists, instead of using direct mailto: links I made those links point to a simple redirector /  script running on my own site.  This script would return either a 301 redirect to the actual mailto: URL, or, if it detected a suspicious access pattern, a page containing lots of random fake e-mail addresses and links to more such pages.  To keep legitimate search bots away from the trap, I set up the robots.txt rule shown above, disallowing the entire space of both legit redirector links and trap pages. Just recently, however, one of the people in the club searched Google for their own name and was quite surprised when one of the results on the first page was a link to the redirector script, with a title consisting of their e-mail address followed by my name.  Of course, they immediately e-mailed me and wanted to know how to get their address out of Google's index.  I was quite surprised too, since I had no idea that Google would index such URLs at all, seemingly in violation of my robots.txt rule. I did manage to submit a removal request to Google, and it seems to have worked, but I'd like to know why and how Google is circumventing my robots.txt like that and how to make sure that none of the disallowed pages will show up in their search results. Ps. I actually found out a possible explanation and solution, which I'll post below, while preparing this question, but  in case someone else might have the same problem.  Please do feel free to post your own answers.  I'd also be interested in knowing if other search engines do this too, and whether the same solutions work for them also. How do I add reCaptcha to a custom form? I need to add a reCaptcha to my form; creating the form then adding the form ID to the reCaptcha settings did nothing. Particular nodes are missing from node editor Fibonacci addition law $F_{n+m} = F_{n-1}F_m + F_n F_{m+1}$ How to Store Fresh Herbs checking apt-get update lock file Apparently $1+2+3+4+\ldots+n = \dfrac{n\times(n+1)}2$.  How? What's the proof? Or maybe it is self apparent just looking at the above?   PS: This problem is known as "The sum of the first $n$ positive integers". Why shouldn't the denominator of the covariance estimator be n-2 rather than n-1? How to get own process pid from the command prompt in Windows I'm trying to find a way to get my own PID from a command prompt (for later use in bat scripts).  So far the only useful way I found was to use getpids.exe from here : , but I'm looking for a command that's "built in" to Windows.  I'm looking for a "bullet proof" way. No assumptions about my process being the only cmd.exe or anything. How do you perform a left outer join using linq extension methods Assuming I have a left outer join as such:  from f in Foo join b in Bar on f.Foo_Id equals b.Foo_Id into g from result in g.DefaultIfEmpty() select new { Foo = f, Bar = result }   How would I express the same task using extension methods? E.g.  Foo.GroupJoin(Bar, f =&gt; f.Foo_Id, b =&gt; b.Foo_Id, (f,b) =&gt; ???)     .Select(???) how to copy or backup files ignoring dot files I want to back-up all files from my laptop partitions to external HDD.  I ran, for example  cp -a /med*/ravb*/*00   /med*/ravb*/M*L*/7.3GB_CP &amp;&amp; echo "7.3GB BACKED UP PROPERLY" || echo "7.3GB FAILED TO BACK UP"   The issue is that dot files are also getting included which I don't want. What should I do so as to ignore all dot files for backing up. What does $\bigcup_{i=0}^{\infty}[i, i+2]$ mean? I think I get it but I wanted to be sure before attempting the question:  Question  Describe the following set, and prove your answers correct. (Here brackets denote intervals on $\mathbb{R}$.)  $\bigcup_{i=0}^{\infty}[i, i+2]$  Does it mean: {$0, 1, 2, 3, 4, 5...,\infty$} $\cup$ {$2, 3, 4, 5, 6, 7,...,\infty$}?  If so, what is the difference between:  $\bigcup_{i=0}^{\infty}[i, i+2]$ and $\bigcup_{i=0}^{\infty}(i, i+2)$ Suppose that $f$ is a function defined in $[a;b]$ to $[a;b]$ and continuous on $[a;b]$. The problem is I haven't the definition of the function, this is more abstract, but even if how can I prove that $f$ would have a fixed point? I've already taken my calculus sequence and I'm interested in brushing up and staying sharp on the basics. So far, my calculus background is limited to single-variable calculus, which I applied in my physics sequence and engineering statistics. I learned a little bit of vector math in physics as well, but I'm not strong in it. My mathematical strengths lie in the discrete mathematics.  I'm particularly interested in studying for my IEEE Certified Software Development Associate exam - 10% of the exam is mathematics (calculus, differential equations, and statistics). Calculus is one of the mathematics knowledge areas that a software engineer should be competent in, so I'm looking for not only solidifying the courses that I've already taken, but moving forward with slightly more advanced topics, at an undergraduate mathematics level.  I'm currently using the textbook from my calculus sequence, but I'm interested to know what books other people used to learn calculus and if the book is potentially worth checking out.  What books are available to help me? Proof using Prüfer encoding The question is as below:      Show that each vertex $v$ of a tree $T$ appears $deg(v)-1$ times in the Prüfer encoding of $T$, where $deg(v)$ is the degree of $v$ in $T$.   For this, I think there are 3 scenarios a leaf should be considered for: (1) when it is a leaf as part of a tree; (2) a leaf that has been discarded; (3) the remaining edge. I feel like this will result in a short proof which is only two (or so) statements long, but at the same time, feel it is too simple.   EDIT: I've had a look at this again and narrowed it down to 2 cases:   Case 1: The vertex $v$ in question has $deg(v)\ge2$. $v$ then loses its neighbours as the algorithm is applied repeatedly until $v$ becomes a leaf itseelf. At this point, $v$ is attached to another neighbour, leaving an edge. This means the algorithm can no longer be applied and we have obtained the final Prüfer Encoding for the tree $T$.  Case 2: The vertex $v$ has $deg(v)\ge 2$. It loses its neighbours as the algorithm is applied repeatedly but is deleted itself at some point in the process.   Have I gone about this wrong?  Thank you. Why did the TIE fighter in The Force Awakens have life support?