Yusuke ENDOH writes:
Periodically when fetching web pages using open-uri, he notices that many different kinds of exceptions can be raised.
So far, he’s experienced these below:
-
Errno::ETIMEDOUT
bigobj = range(int(10e6)) | |
print "waiting..." | |
def child(): | |
print "waiting inside child" | |
time.sleep(10) | |
from multiprocessing import Process |
FROM python:2.7 | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
xvfb \ | |
chromium \ | |
chromedriver | |
RUN pip install selenium |
FROM python:2.7 | |
RUN apt-get update && \ | |
apt-get install -y locales-all apt-transport-https unzip && \ | |
curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ | |
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \ | |
apt-get update && \ | |
apt-get install -y google-chrome-stable && \ | |
wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip && \ | |
unzip chromedriver_linux64.zip && \ |
#include <stdio.h> | |
int is_blank(int c) { | |
return c == ' ' || c == '\t' || c == '\n'; | |
} | |
int is_opt(char *o, char opt) { | |
return o[0] == '-' && o[1] == opt && o[2] == '\0'; | |
} |
/* | |
gcc -o 0 0.c | |
./0 | |
*/ | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
printf("Hello %s!\n", argv[1]); |
#!/usr/bin/env python | |
""" | |
Copied from http://stackoverflow.com/a/25708957/565999 | |
""" | |
import SimpleHTTPServer | |
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def end_headers(self): | |
self.send_my_headers() | |
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self) |
from galaxy import Galaxy | |
G = Galaxy([1,2,3,4,5,6]) # creates 6 universes | |
G.assert_(lambda x: x > 3) # destroys universes 1,2,3 | |
G.assert_(lambda x: x < 6) # destroys universe 6 | |
print(G.all()) | |
print(G.any()) |
SELECT table_name AS "Tables", | |
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB", | |
round(((data_length + index_length) / 1024 / 1024 / 1024), 2) "Size in GB" | |
FROM information_schema.TABLES | |
WHERE table_schema = "PUT_DATABASE_NAME_HERE" | |
ORDER BY (data_length + index_length) DESC; |
import boto | |
def find_autoscaling_groups_by_instance(instance_id): | |
asg = boto.connect_autoscale() | |
groups = [] | |
g = asg.get_all_groups() | |
groups.extend(g) | |
while g.next_token: |