First, generate a set of SSH keys:
ssh-keygen
Setup the ~/.ssh/config so, by default, we login with a specific user (in this case, root):
Host hadoop01
| # coding: utf-8 | |
| # http://stackoverflow.com/questions/26794029/how-to-remove-duplicate-letters-in-a-comma-separated-cell | |
| # In[1]: | |
| text = """A,B,B,C | |
| G,G,A,T | |
| G,A,A | |
| T,T""" |
| # http://stackoverflow.com/questions/26793632/beautifulsoup-unable-to-to-read-the-complete-html-table | |
| # coding: utf-8 | |
| # In[1]: | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| #!/usr/bin/env python | |
| # suggested gmail code for StackOverflow question: http://stackoverflow.com/questions/26772416/how-to-write-a-program-to-check-website-for-a-string | |
| import smtplib | |
| from email.mime.text import MIMEText | |
| from email.mime.application import MIMEApplication | |
| from email.mime.multipart import MIMEMultipart | |
| def sendEmail(fileName, emailTo): |
| """ | |
| http://stackoverflow.com/questions/26564513/python-valid-ips-from-each-line-on-a-text-file/26564920#26564920 | |
| iplog.txt: | |
| Host : 75.75.75.75 , DNS : resolved dns , Location : USA | |
| Host : 266.266.266.266 , DNS : resolved dns , Location : USA | |
| Host : 10.0.1.1 , DNS : resolved dns , Location : USA | |
| ipclear.txt: | |
| 75.75.75.75 |
| #http://stackoverflow.com/questions/26500406/why-when-add-where-clause-in-sql-statement-query-return-no-data | |
| """ | |
| create table tb_test | |
| ( | |
| id integer, | |
| name varchar(255), | |
| date date | |
| ); | |
| insert into tb_test (id, name, date) values (0,'Mike','2014-04-24'); |
| # ssh into your AWS instance and setup s3fs: | |
| sudo yum install git gcc libstdc++-devel gcc-c++ fuse fuse-devel curl-devel libxml2-devel openssl-devel mailcap automake | |
| git clone git://github.com/s3fs-fuse/s3fs-fuse.git | |
| cd s3fs-fuse/ | |
| ./autogen.sh | |
| ./configure --prefix=/usr | |
| make |
| """ | |
| # http://stackoverflow.com/questions/26248943/mysql-sseparate-value-from-one-column-to-several-rows-and-join-with-other-column | |
| setup the tables: | |
| create table papers | |
| ( | |
| paper_title varchar(10), | |
| authors varchar(10), | |
| year integer |
| library(gputools) | |
| library(e1071) | |
| library(fueleconomy) | |
| data(vehicles) | |
| vehicles$id <- NULL | |
| vehicles$hwy <- NULL | |
| vehicles <- as.data.frame(unclass(vehicles)) | |
| vehicles <- vehicles[complete.cases(vehicles), ] |
| """ | |
| This scrapes Amazon's distribution centers from the web and creates a file of markers for an interactive map created in Leaflet.js | |
| For now (10/03/2014) it can be viewed at http://54.172.30.118/amzn-locations.html | |
| """ | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| from pygeocoder import Geocoder | |
| import time |