Skip to content

Instantly share code, notes, and snippets.

@atsaki
atsaki / file0.js
Last active January 30, 2016 21:04
ブラウザのコンソールでスクレイピング ref: http://qiita.com/atsaki/items/26c3e5814a10dcb45609
$$('CSSセレクタ').map(e => doSomething(e)).join('\n')
copy($_)
@atsaki
atsaki / CentOS66-Vagrant-30G
Last active August 30, 2020 09:44
AnsibleでCloudStackを操作する(応用編:テンプレートのカスタマイズ) ref: http://qiita.com/atsaki/items/bb2145bf50e6009d6e6b
---
template_name: "CentOS 6.6 64-bit"
template_volume_size: 30
@atsaki
atsaki / .env
Last active December 23, 2015 17:35
AnsibleでCloudStackを操作する(基礎編:仮想マシン作成とプロビジョニング) ref: http://qiita.com/atsaki/items/6db23d3f4aa3a3c5da41
CLOUDSTACK_ENDPOINT=<APIのエンドポイント>
CLOUDSTACK_KEY=<APIキー>
CLOUDSTACK_SECRET=<シークレットキー>
CLOUDSTACK_TIMEOUT=60
@atsaki
atsaki / file0.txt
Last active December 4, 2015 16:26
CloudStack APIをコマンドラインから手軽に使うためのスクリプト csfind ref: http://qiita.com/atsaki/items/5f650e2e4519d0c1a159
zoneid=$(
cs listZones name=joule | jq -r ".zone[0].id"
)
templateid=$(
cs listTemplates \
templatefilter=all \
zoneid=$zoneid \
name="CentOS 7.1 64-bit" |
jq -r ".template[0].id"
)
@atsaki
atsaki / file0.txt
Last active September 27, 2015 03:36
Apolloを使ってAWSにMesos+Marathon+Chronos環境を構築する ref: http://qiita.com/atsaki/items/5694f93b2f064f5911fe
$ git clone https://github.com/Capgemini/apollo.git
$ cd apollo
@atsaki
atsaki / file0.py
Last active September 19, 2015 16:02
Azure Machine LearningのJupyter Notebookを使ってみる ref: http://qiita.com/atsaki/items/e94f3c656113580bdf43
from azureml import Workspace
ws = Workspace(
workspace_id="YOUR_WORKSPACE_ID",
authorization_token="YOUR_AUTHORIZATION_TOKEN",
endpoint="https://studio.azureml.net"
)
@atsaki
atsaki / Vagrantfile
Last active December 4, 2015 02:29
Vagrant+Docker Machine Generic Driverを使ってDockerホスト・Swarmクラスタを構築する ref: http://qiita.com/atsaki/items/0b48daf4858c61cb29e0
Vagrant.configure(2) do |config|
# vagrant-triggersをProvisionerとして使用し、
# 作成した仮想マシンに対してdocker-machine createを実行
config.vm.provision "trigger" do |trigger|
trigger.fire do
# docker-machine statusのexitstatusが0の場合はdocker-machine create実行済み
`docker-machine status #{@machine.name}`
if $?.exitstatus != 0
# 使用するIPとポートを取得
# VirtualBoxの場合には一度仮想マシンにログインしプライベートネットワークのIPを取得
@atsaki
atsaki / file1.txt
Last active August 29, 2015 14:27
fluentdのラベルの挙動 ref: http://qiita.com/atsaki/items/9427176fc497171a4907
$ fluentd -c rewrite_tag_filter.conf -vv --use-v1-config &
$ echo "{\"value\": \"test\"}" | fluent-cat test
@atsaki
atsaki / Vagrantfile
Created August 15, 2015 13:24
requirettyが有効なイメージを使用する ref: http://qiita.com/atsaki/items/467ce1569fbc2cb11cb8
Vagrant.configure("2") do |config|
config.vm.provider :cloudstack do |cloudstack, override|
override.vm.box = "dummy"
override.vm.box_url = "https://github.com/schubergphilis/vagrant-cloudstack/raw/master/dummy.box"
cloudstack.host = "compute.jp-east.idcfcloud.com"
cloudstack.path = "/client/api"
cloudstack.port = "443"
cloudstack.scheme = "https"
@atsaki
atsaki / __init__.py
Created August 10, 2015 17:41
sqlparseによるSQLのフォーマット ref: http://qiita.com/atsaki/items/eb36a6a7935d525a43e7
def format(sql, **options):
"""Format *sql* according to *options*.
Available options are documented in :ref:`formatting`.
In addition to the formatting options this function accepts the
keyword "encoding" which determines the encoding of the statement.
:returns: The formatted SQL statement as string.
"""
encoding = options.pop('encoding', None)
stack = engine.FilterStack()
options = formatter.validate_options(options)