LOLIPOP!マネージドクラウドを使ってみる。
先日、僕のバイト先の人にブログを読んでいただいたようで。 会社の人から、「チョコレートは糖質ですね。」という注告とと物に「なんでブログ、マネクラじゃないの?」と言われたので使ってみる。
僕は昔、ユーザ登録だけしていたのでログインしてこの画面から
念のため公開鍵だけ追加しておく
$ cat .ssh/id_rsa.pub | pbcopy
ダッシュボードのプロジェクトの作成に進むから、ワードプレスを選んで必要事項を埋める。
おお、すぐにできた。
プロジェクト一覧から、転送量とかいろいろ確認できるみたい。sshコマンドも書いてあるのでとても便利
試しにsshしてみよう。
$ ssh -p 37566 wandering-hita-7307@ssh-1.mc.lolipop.jp Last login: Sun Feb 25 05:06:08 2018 from 10.1.1.1 __ __ ____ _ _ _ | \/ |/ ___| | | ___ | (_)_ __ ___ _ __ | |\/| | | | | / _ \| | | '_ \ / _ \| '_ \ | | | | |___ _| |__| (_) | | | |_) | (_) | |_) | |_| |_|\____(_)_____\___/|_|_| .__/ \___/| .__/ |_| |_| ******* Welcome to Lolipop! Managed Cloud ******* wandering-hita-7307@php-chiwata:~$
ものすごく簡単だった。所要時間は五分程度。
golangでfizzbuzz
記事を二本にする必要は一切なかったが、お布団でもぞもぞしてたらなんとなーく書きたくなったのだ。
fizzbuzz問題は説明する必要ないでしょう。
昔流行った芸人みたいなあれ
とりあえずこんな感じー
$ cat fizzbuzz.go package main import "fmt" func main(){ i := 0 for i < 15 { i++ if i % 5 == 0 && i % 3 == 0 { fmt.Println("fizzbuzz") } else if i % 5 == 0 { fmt.Println("fizz") } else if i % 3 == 0 { fmt.Println("buzz") } else { fmt.Println(i) } } }
んで実行。
$ go run fizzbuzz.go 1 2 buzz 4 fizz buzz 7 8 buzz fizz 11 buzz 13 14 fizzbuzz
うん。まあ問題ないでしょう。
行末に;
をつけなかったり、ifに()
がいらなかったり。しかも{}
は必須らしい。
しばらくしたら慣れるかなー
golangに入門してみる。
多分三日坊主、あんまりちゃんと書けるようになる前に飽きると思うけど、試しに書いてみよう。
とりあえず今の僕の環境
$ sw_vers ProductName: Mac OS X ProductVersion: 10.13.3 BuildVersion: 17D47
んで、とりあえずgoをインストールbrewで一発
$ brew install go
おっけー。
gopathを書き換えておくbashrc
にこんな感じの行を追加
export GOPATH=/Users/HideyukiChiwata/dev
読み込んで確認してみる。
$ . .bashrc $ echo $GOPATH /Users/HideyukiChiwata/dev
よし。 んじゃ、とりあえずおきまりのハローワールドを
$ cat main.go package main import "fmt" func main() { fmt.Println("Hello World!") } $ go run main.go Hello World!
とりあえずちゃんと動きそうね。 続きは眠くない時に。
余った材料で手抜きプリンタルトを作る
いいですか。自分で食べるのに一生懸命きれいに作っても仕方ないのです。
見た目がよくてもそれはインスタグラムで映えるだけなのです。
今回は作業中の写真がないので適当にいきます。
材料
生クリーム 200ml
牛乳 100ml
全卵 2個
卵黄 2個
砂糖 30g
バニラビーンズとかバニラオイル
タルト生地(市販のでも作ってもいい)
まず、オーブンを170度に予熱しておく。
待ち時間の間にプリン液をつくる。
材料を入れる順番はとくにない。混ざれば大丈夫。
どんなにめんどくさくても裏漉しを三回くらいしよう。卵白が塊のまま残っていると舌触りがとてもよくない。また、砂糖が溶けきっているかもここで確認できる。
できたプリン液をタルト生地に流し込んで170度で30分くらい焼く
こんなかんじ。
ちょっと甘さ控えめ気味になるので、その辺は調整を。
バレンタイン直前なので、生チョコを作る
表題の通り、ちなみに私は男だ。
材料は
製菓用チョコレート300g
生クリーム(動物性のやつ) 200ml
酒(あるものなら何でもよい) 30ml
バター 25g
純ココア 好きなだけ
生クリームが一本200mlで市販されているので、それに合わせた分量で作る
酒は、サントリーオールドがあったのでそれを使う
まず、チョコレートを細かく刻み湯煎
この時にしっかりチョコレートを溶かしきる
溶かしきったら生クリーム半分を加える
色が均一になったらもう半分を加えて、酒を入れる、酒がなければ牛乳を同量入れてもよい
手元にある適当なバットにクッキングペーパーを敷き、流し込み、少し揺らして気泡を抜く
冷蔵庫に入れて寝る
起きたら適当なサイズに切る(私の睡眠時間は八時間)
チョコレート同士がくっつかない程度にココアをかける
おしまい。
レンサバ屋さんでアルバイトを初めて270日たった話
突然だが、僕は福岡のレンタルサーバー屋さんでインフラエンジニアのアルバイトをしている。
きっかけはひょんなもので、大学サークルのOBがノリと勢いで紹介してくださり、その勢いのまま面接へ、僕みたいな平凡な大学生を採用するわけがないと思って気楽に構えていたら、なぜか採用。人生のチャンスとはいきなり巡ってくるものだ。びっくり。
それまで、サーバやLinuxなんてせいぜいサークルでファイルサーバーとかgitサーバとか簡単なものをネットの情報のコピペで作って、作ったら作ったきり、動かない日もあると言うような感じだったのに、いきなりプロの人たちの世界に、来る日も来る日もわからないことだらけ。おそろしや。
ここに来てから、いろんなことがあった。
すごい人たちに囲まれて、いろんなものに触れられる。しかも時給が高い。大丈夫か会社。
僕が大学にいる間はお世話になると思うが、しっかり成長できるようにがんばろう
研究室のサーバを新しくする(準備)
研究室にあるサーバが3台ある。
Minecraftとwikiのサーバ、研究室生用smbサーバ、授業資料配布用smbサーバ
この3台をVMにして一台にしたい。
仮想化ソフトウェアに何を使おうかいろいろ考えたが、今回はKVMとvagrantにすることに。
とりあえず母艦になるサーバに環境を作る
[root@localhost ~]# yum install qemu-kvm libvirt libvirt-devel gcc patch -y [root@localhost ~]# modprobe kvm_intel [root@localhost ~]# systemctl restart libvirtd
とりあえずこんなもんか つぎはvagrant
[root@localhost ~]#curl -LO https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.rpm [root@localhost ~]#rpm -ivh vagrant_2.0.2_x86_64.rpm [root@localhost ~]#vagrant plugin install vagrant-libvirt [root@localhost ~]#vagrant box add centos/7
これで準備できたはず
[root@localhost ~]# vagrant init centos/7 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. [root@localhost ~]# vagrant up Bringing machine 'default' up with 'kvm' provider... ==> default: Box 'centos/7' could not be found. Attempting to find and install... default: Box Provider: kvm default: Box Version: >= 0 ==> default: Loading metadata for box 'centos/7' default: URL: https://vagrantcloud.com/centos/7 The box you're attempting to add doesn't support the provider you requested. Please find an alternate box or use an alternate provider. Double-check your requested provider to verify you didn't simply misspell it. If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is released. Name: centos/7 Address: https://vagrantcloud.com/centos/7 Requested provider: [:kvm]
あれ、こけた プロバイダを指定しないといけないのか、、、
[root@localhost ~]# vagrant up --provider=libvirt Bringing machine 'default' up with 'libvirt' provider... ==> default: Creating image (snapshot of base box volume). Volume for domain is already created. Please run 'vagrant destroy' first.
指定して見たけどダメ。 どうやら、作成されたボリュームがあるとダメみたい。
[root@localhost ~]# virsh vol-list default 名前 パス ------------------------------------------------------------------------------ root_default.img /var/lib/libvirt/images/root_default.img [root@localhost ~]# rm /var/lib/libvirt/images/root_default.img
確認して削除
[root@localhost ~]# systemctl restart libvirtd [root@localhost ~]# vagrant up --provider=libvirt Bringing machine 'default' up with 'libvirt' provider... ==> default: Creating image (snapshot of base box volume). ==> default: Creating domain with the following settings... ==> default: -- Name: root_default ==> default: -- Domain type: kvm ==> default: -- Cpus: 1 ==> default: ==> default: -- Feature: acpi ==> default: -- Feature: apic ==> default: -- Feature: pae ==> default: -- Memory: 512M ==> default: -- Management MAC: ==> default: -- Loader: ==> default: -- Base box: centos/7 ==> default: -- Storage pool: default ==> default: -- Image: /var/lib/libvirt/images/root_default.img (41G) ==> default: -- Volume Cache: default ==> default: -- Kernel: ==> default: -- Initrd: ==> default: -- Graphics Type: vnc ==> default: -- Graphics Port: -1 ==> default: -- Graphics IP: 127.0.0.1 ==> default: -- Graphics Password: Not defined ==> default: -- Video Type: cirrus ==> default: -- Video VRAM: 9216 ==> default: -- Sound Type: ==> default: -- Keymap: en-us ==> default: -- TPM Path: ==> default: -- INPUT: type=mouse, bus=ps2 ==> default: Creating shared folders metadata... ==> default: Starting domain. ==> default: Waiting for domain to get an IP address... ==> default: Waiting for SSH to become available... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Configuring and enabling network interfaces... default: SSH address: 192.168.121.10:22 default: SSH username: vagrant default: SSH auth method: private key ==> default: Rsyncing folder: /root/ => /vagrant
あがってきた
[root@localhost ~]# vagrant ssh [vagrant@localhost ~]$
いけた。
とりあえず、今日はここまで、また時間がある時に他の設定をしよう。