Google Custom Search API 使う
概要
画像をたくさん集めたいのでGoogle画像検索的なものがないか調べてみた。下の「経緯」はどうでもいい話なので読み飛ばしOK
経緯
画像を検索するわけだから Google Image Search APIとかでぐぐるとそっくりそのままの名前のAPIが出て来るが、Deprecatedになっていて、現在は同機能がGoogle Custom Search APIに統合されている。
無料だと100クエリ/dayまで無料で使えるようなのと、1000クエリが$5で購入できるらしいので今回はそんなに負担にならなさそうなのでよしとした。
使い方
大体ここみればわかる -> Google Custom Search API
scalatra / playで使えるscalaデータベースライブラリ学習
概要
scalaのデータベースまわりを知る
Play
用語:
- jdbc 下に示すようなDBとの接続API JDBCとは何か
- h2 H2 database
- SQLite
- PostgreSQL
- MySQL
how to install Java8 and IntelliJ IDEA with Chef
Overview
this is continuation of the entry: akzero.hatenablog.com
and you'll create project like this: basic-development-machine
we should learn:
version
VirtualBox: 5.1.6 Vagrant: 1.8.5 ChefDK: 0.18.26
preparation
$ vagrant plugin install vagrant-vbguest $ vagrant plugin install vagrant-omnibus
refer to:
todos
find cookbooks from Chef Supermarket
$ vi Berksfile
write:
source 'https://supermarket.chef.io' cookbook 'java' cookbook 'idea'
download cookbooks
$ berks vendor cookbooks
specify settings
$ mkdir roles $ cd roles $ vi java.json $ vi idea.json
{ "name":"java", "description":"Install Oracle Java", "default_attributes":{ "java":{ "install_flavor":"oracle", "jdk_version":"8", "oracle":{ "accept_oracle_download_terms":true } } }, "run_list":[ "recipe[java]" ] }
- idea.json
{ "name":"idea", "description":"Install IntelliJ IDEA", "default_attributes":{ "idea":{ "setup_dir":"/home/vagrant", "user":"vagrant", "version":"2016.2.4" } }, "run_list":[ "recipe[idea::default]" ] }
provisioning settings (uses xubuntu 16.04 box we created at previous entry, it's on my github repository)
$ vi Vagrantfile
write
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "xubuntu-16.04-desktop-amd64.box" config.vm.box_url = "https://github.com/akzero53/xubuntu-16.04-vagrant-box/releases/download/v1.0.0/xubuntu-16.04-desktop-amd64.box" config.omnibus.chef_version=:latest config.vm.provision "chef_solo" do |chef| chef.roles_path = ["roles"] chef.add_role("java") chef.add_role("idea") end config.vm.provider "virtualbox" do |vb| vb.gui = true vb.memory = "2048" end end
at last
$ vagrant up --provision
how to create xubuntu 16.04 LTS vagrant base box
Overview
this is how to create vagrant base box for xubuntu 16.04.
you'll get box like: xubuntu-16.04-desktop-amd64.box after this todos.
environment
- OSX 10.11.6
preparation
- VirtualBox 5.0.18 | 5.0.26 | 5.1.6
- vagrant 1.7.4 | 1.8.5
todos
install xubuntu to virtualbox
- download: xubuntu-16.04-desktop-amd64.iso
- virtualbox: 'New'
- Name: xubuntu-16.04-desktop-amd64
- 'Create'
- set maximum 'File size', see: Creating a Base Box - Disk Space if you forget this, you'll be lack of disk space.
- disable unnecessary settings, see: Creating a Base Box - Peripherals
- 'Start'
- and mount iso to install
- username, password must be "vagrant"
after installation
log in with vagrant user
install openssh-server
$ sudo apt-get install openssh-server -y
if you want to ssh to this machine from host os, configure 'Settings' -> Network -> Advanced -> 'Port Forwarding'
- Host IP: 127.0.0.1
- Host Port: 2222
- Guest IP: 10.0.2.15
- Guest Port: 22
and from Host OS
$ ssh vagrant@127.0.0.1 -p 2222
set root password vagrant
$ sudo passwd vagrant vagrant
sudo with no password
$ sudo visudo
and rewrite line [A] with [B]
[A] %sudo ALL=(ALL:ALL) ALL [B] %sudo ALL=(ALL) NOPASSWD: ALL
put vagrant public key
$ cd ~ $ mkdir .ssh $ cd .ssh $ wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub $ mv vagrant.pub authorized_keys $ chmod 600 authorized_keys
configure sshd_config
$ sudo vi /etc/ssh/sshd_config
and rewrite line [A] with [B], add [C]
[A] #AuthorizedKeysFile %h/.ssh/authorized_keys [B] AuthorizedKeysFile %h/.ssh/authorized_keys [C] UseDNS no
if you want to get smaller box
# Zero free space to aid VM compression dd if=/dev/zero of=/EMPTY bs=1M rm -f /EMPTY
refer to: Making smaller base boxes #343
shut down virtual machine
package box
in the Host OS
$ vagrant package --base xubuntu-16.04-desktop-amd64
check
$ vagrant box add xubuntu-16.04-desktop-amd64.box package.box $ vagrant init xubuntu-16.04-desktop-amd64.box
if you want to launch GUI
$ vi Vagrantfile
and configure:
# Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true # Customize the amount of memory on the VM: # vb.memory = "1024" vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"] end
and, you'll need vagrant-vbguest. more information: vagrant-vbguest
$ vagrant plugin install vagrant-vbguest
finally start the machine
$ vagrant up --provider virtualbox