Mr Cheng bio photo

Mr Cheng

  • created DigitalOcean node through terraform
  • registered sshkey in github
  • verified python-based Google query reproduced on the VM
  • installed git manually

todo for next time, via ansible:

  • install git
  • register pubkey automatically with github

Notes

I’d rather run these python Google searches off a DigitalOcean node. First let’s time bound this since I’m at work. Timer set to 15 minutes https://www.google.com/search?q=timer+15+minutes

Stole pre-existing terraform to launch a node:

$ terraform show
digitalocean_droplet.node:
id = 90602327
  disk = 30
  image = ubuntu-16-04-x64
  ipv4_address = 206.189.160.13
  locked = false
  name = node0
  price_hourly = 0.01488
  price_monthly = 10
  region = sfo2
  resize_disk = true
  size = 1gb
  ssh_keys.# = 1
  ssh_keys.0 = 19717796
  status = active
  tags.# = 0
  vcpus = 1


	Outputs:

	node_ip_addresses = [
	    206.189.160.13
	]

then:

apt install python-pip
pip install google

… and manually put this into /root/test.py:

from googlesearch import search

query = "john cheng"

for j in search(query, tld="co.in", num=10, stop=1, pause=2):
    print(j)

6 minutes left. let’s pull the snippet of python from git:

apt-get install git

ok, will need to upload a currently non-existant sshkey, so created it with a ssh-keygen with all defaults:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2115Q8QajYp//AcFRzQMXP1B31GEpFvl4a2ECOIqeVTq+fVkbQ77FgQSJblY0qqcDWZ9J/Z9uqZKQb9RtAVfpgskkcSSTNkatzTAUGrO/XX8IiBL6RCNvBKsqeZYAoBxYZzgww+ovAEw37sQLxklGZBdLRTBMIIgCyLxs5vL1a6WV/2WyhcDM5fOMSEDrrKTNQwfZrHsQ2EhPm9/XEsr/1Tp/ZyDPPKXT3tvt7CkoUcGE5HdEmLpHc4zWCDdkeUgRr4NfbsrOxSMQCNDX55cd8ogcR5WMwUY25jw/zazTrThWWdTL7HlPCFmt/dXQLRh/EicRLXEbd900KQXc6hTX root@node0

now:
git clone git@github.com:jch3ng/python-jcsearch.git

and just to verify:

# python /root/jchacklog/day1/run.py
https://en.wikipedia.org/wiki/John_Cheng
https://en.wikipedia.org/wiki/John_Cheng#Career
https://en.wikipedia.org/wiki/John_Cheng#Personal_life
https://en.wikipedia.org/wiki/John_Cheng#Death
https://en.wikipedia.org/wiki/John_Cheng#Filmography
http://www.imdb.com/name/nm0155579/
https://www.imdb.com/name/nm1766738/
http://deadline.com/2018/02/hartbeat-productions-john-cheng-hire-kevin-hart-president-of-film-1202306012/
https://www.linkedin.com/in/john-cheng-876a0
https://sg.linkedin.com/in/johnchengcl
https://www.linkedin.com/in/johnlicheng
https://twitter.com/mrjohncheng?lang=en
https://www.facebook.com/public/John-Cheng
https://ratpacentertainment.com/john-cheng/