Skip to content

Instantly share code, notes, and snippets.

type: "SNIPPET_NOTE" folder: "8627da1bf102af6f03bd" title: "機械学習に関するリンク" description: "機械学習に関するリンク" snippets: [ { name: "" mode: "text" content: '''

type: "MARKDOWN_NOTE" folder: "700c212bfd0bcad461e3" title: "PostgreSQLでテーブル名カラム名を取得する方法" content: '''

PostgreSQLでテーブル名カラム名を取得する方法

SELECT
    relname AS table_name
FROM

type: "MARKDOWN_NOTE" folder: "700c212bfd0bcad461e3" title: "mysql実行中のプロセスの一覧を表示する" content: '''

mysql実行中のプロセスの一覧を表示する

SHOW PROCESSLIST;
SHOW FULL PROCESSLIST;

type: "MARKDOWN_NOTE" folder: "8d171ada824e9dcec74a" title: "windows10でvirtualbox起動できない場合の対応" content: '''

windows10でvirtualbox起動できない場合の対応

最近Windows10がアップデートされたらVirtualBoxが起動しなくなってしまったので、もしお困りの方がいればご参考までに。

どの仮想マシンを起動しても、上記エラーで失敗。

type: "MARKDOWN_NOTE" folder: "31084c9845a077607f09" title: "遅い通信だとChromeはdocument.writeで外部のスクリプトを読み込んでも動かなくなるらしい("A Parser-blocking, cross-origin script, URL, is invoked via document.write."について)" content: '''

遅い通信だとChromeはdocument.writeで外部のスクリプトを読み込んでも動かなくなるらしい("A Parser-blocking, cross-origin script, URL, is invoked via document.write."について)

Google Chromeを使って、document.write()で外部のJavaScriptを読み込んでいるページを開くと、いつの間にか開発者ツールのコンソールに以下のようなメッセージが出る状態になっていた

"A Parser-blocking, cross-origin script, スクリプトのURL, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity."

@fs-wu
fs-wu / md5_for_ruby.rb
Created December 9, 2016 01:40
rubyでmd5を使用する例
require "digest/md5"
a = "/bd_gl8bdu_1/query?rid=147&disp_cnt=14&div_id=reco_brand&cb=drawReco&cb_err=&item_id=M01092BW00021&brand_code=M01092"
Digest::MD5.hexdigest(a)
>>> c71326bc27535b528630a2a9af235a5a
@fs-wu
fs-wu / install-gradle.sh
Last active August 31, 2016 08:59
gradle install script
gradle_version=2.9
cd /tmp
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
mkdir /opt/gradle
unzip -oq ./gradle-${gradle_version}-all.zip -d /opt/gradle
ln -sfnv gradle-${gradle_version} /opt/gradle/latest
printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
hash -r ; sync
gradle -v
# install postgres and ruby
yum update -y
sudo service iptables stop
sudo service ip6tables stop
sudo service nfs stop
sudo service nfslock stop
sudo service mdmonitor stop
sudo chkconfig iptables off
sudo chkconfig ip6tables off
sudo chkconfig nfs off
require 'aws-sdk'
# ENV NEED:
# # ENV['AWS_REGION']
# # ENV['BDASH_OPT_DB_HOST']
# # ENV['BDASH_OPT_DB_USERNAME']
# # ENV['BDASH_OPT_DB_PASSWORD']
# # ENV['BDASH_OPT_DB_NAME']
def get_aws_account_id
begin
@fs-wu
fs-wu / aws.md
Last active January 15, 2016 05:37
Instance Protection for Auto Scaling

AWS CLIの場合

aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names AOPTBAT_201601140348
aws autoscaling update-auto-scaling-group --auto-scaling-group-name AOPTBAT_201601140348 --max-size 2 --desired-capacity 2
aws autoscaling set-instance-protection --instance-ids i-89e64700 --auto-scaling-group-name AOPTBAT_201601140348 --protected-from-scale-in
aws autoscaling update-auto-scaling-group --auto-scaling-group-name AOPTBAT_201601140348 --max-size 0 --desired-capacity 0
aws autoscaling set-instance-protection --instance-ids i-89e64700 --auto-scaling-group-name AOPTBAT_201601140348 --no-protected-from-scale-in

instance id を取得