Skip to content

Instantly share code, notes, and snippets.

View TakashiSasaki's full-sized avatar

Takashi SASAKI TakashiSasaki

View GitHub Profile
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@TakashiSasaki
TakashiSasaki / Moodleのコースにおけるユーザーへのロール割り当てに基づいた学生数と教員数の集計.sql
Last active December 26, 2015 02:29
Moodle 2.xでコースの参加者数を集計するためのMySQLに対するクエリ。 何度も何度も面倒なのでもうここにメモっておく。 「Moodleのコースにおけるユーザーへのロール割り当てに基づいた学生数と教員数の集計.sql」をビューにしようとしたらサブクエリが複数の行を返すって怒られた。 ンな事ないんだがなぁ。 VIEWをかましています。周囲のSQLerによるとSQL音痴のやることだとか。ごめんね。
SELECT コースID AS courseid, コース名, コース省略名 AS 省略名,
(SELECT SUM(人数) FROM 集計_参加者数 WHERE コースID=courseid GROUP BY コースID) AS `参加者数`,
ifnull((SELECT 人数 FROM 集計_参加者数 WHERE ロール="Student" AND コースID=courseid),0) AS `学生権限の人数`,
ifnull((SELECT 人数 FROM 集計_参加者数 WHERE ロール="Teacher" AND コースID=courseid),0) AS `教員権限の人数`
FROM 集計_参加者数
GROUP BY courseid
@TakashiSasaki
TakashiSasaki / SDKSetup_7.0.6918.0.log
Last active December 28, 2015 07:19
Windows SDK for Windows 7 and .NET Framework 4 Installation Failed. After I uninstalled all VC++ and VJ# related redistributable packages, It succeeded.
17:49:24 2013年11月14日: -------------------------------------------------------------------------------------------------
17:49:24 2013年11月14日: [SDKSetup:Info] Begin
17:49:24 2013年11月14日: [SDKSetup:Info] SDKSetup Version 7.1.7600.30111
17:49:25 2013年11月14日: [SDKSetup:Info] Beginning download of file http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup\SDKSetup.cab to C:\Users\Takashi\AppData\Local\Temp\SDKSetup\SDKSetup.cab
17:49:25 2013年11月14日: [SDKSetup:Info] Successfully downloaded the file http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup\SDKSetup.cab to C:\Users\Takashi\AppData\Local\Temp\SDKSetup\SDKSetup.cab
17:49:25 2013年11月14日: [SDKSetup:Info] SDKSetupDll_DoTasks: Starting
17:49:25 2013年11月14日: [SDKSetup:Info] SDKSetupDll_DoTasksWithGUI: Starting
17:49:26 2013年11月14日: [SDKSetup:Info] Config_OS_Detect: Operating system installation (detected)
17:49:26 2013年11月14日: [SDKSetup:Info] Config_MSI_Detect: Windows Installer Setup (detected
@TakashiSasaki
TakashiSasaki / vista-32-ie7.vmx
Created November 15, 2013 07:46
Microsoft謹製 Internet Explorer 7の動作検証のためのVistaのVMwareイメージを動かすためのvmxファイル。sata0:0.mode = "independent-nonpersistent"にしているのがミソ。
.encoding = "Shift_JIS"
config.version = "8"
virtualHW.version = "10"
numvcpus = "2"
cpuid.coresPerSocket = "2"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
memsize = "1024"
ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
@TakashiSasaki
TakashiSasaki / pip.log
Created March 6, 2014 23:45
PyCharmでGitPythonの最新版3.2 RC1をpipからインストールしようとすると失敗するのは、連動してインストールされるgitdb 0.5.4がPython 3に対応していないからか。未だにprintがステートメント扱いだし。
------------------------------------------------------------
C:\Program Files\JetBrains\PyCharm 3.1.1\helpers\packaging_tool.py run on 03/07/14 08:33:18
DEPRECATION: --no-install, --no-download, --build, and --no-clean are deprecated. See https://github.com/pypa/pip/issues/906.
Downloading/unpacking GitPython==0.3.2.RC1
Getting page https://pypi.python.org/simple/GitPython/
URLs to search for versions for GitPython==0.3.2.RC1:
* https://pypi.python.org/simple/GitPython/0.3.2.RC1
* https://pypi.python.org/simple/GitPython/
Getting page https://pypi.python.org/simple/GitPython/0.3.2.RC1
Could not fetch URL https://pypi.python.org/simple/GitPython/0.3.2.RC1: 404 Client Error: Not Found
@TakashiSasaki
TakashiSasaki / sshd_config
Last active August 29, 2015 13:57
OpenSSHでLANからだけパスワード認証を許可する
# sshd_config の末尾の書いておく。
# PermitRootLoginをyesにするかは微妙。
# Matchさせるアドレスは自分のLANの範囲にする。
Match Address 192.168.0.*
PasswordAuthentication yes
PermitRootLogin yes
@TakashiSasaki
TakashiSasaki / JavaScriptでどうやってクラスっぽいものの継承っぽいもことをやるの?.md
Last active August 29, 2015 14:00
JavaScriptでどうやってクラスっぽいものの継承っぽいもことをやるの?

C++/Java/Pythonでクラスは使ってるしPythonではメタクラスも使うけど、JavaScriptのプロトタイプベースの継承ってのがよく分からん。prototypeプロパティ、prototype.constructorプロパティ、__proto__プロパティ、Object.createメソッド、new演算子なんかの挙動がこんがらがって。アレコレ実験して確かめたつもりになっても、あれ?これってプロパティが設定されているわけじゃなくてプロトタイプチェーンたどって呼び出されてるだけだった、なんてことが多くて。アホやな俺。

#1 JavaScriptにおける継承 とりあえず以下のようにやる。

        var F = function(x){
            this.x = x;
        };
        
        F.prototype.setX = function(x){
@TakashiSasaki
TakashiSasaki / assertion.xml
Last active August 29, 2015 14:00
Shibbolethで返しているアサーションの例
<?xml version="1.0" encoding="UTF-8"?>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="略" IssueInstant="2014-04-30T05:02: 42.901Z" Version="2.0">
<saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">https://idp.lms.ehime-u.ac.jp/idp/shibboleth</saml2:Issuer>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" NameQualifier="https://idp.lms.ehime-u.ac.jp/idp/shibboleth" SPNameQualifier="https://moo.chi.tokushima-u.ac.jp/shibboleth-sp">略</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData Address="アクセス元PCのIPアドレス" InResponseTo="略" NotOnOrAfter="2014-04-30T05:07:42.901Z" Recipient="https://moo.chi.tokushima-u.ac.jp/Shibboleth.sso/SAML2/POST" />
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2014-04-30T05:02:42.901Z" NotOnOrAfter="2014-04-30T05:07:42.901Z">
<?xml version="1.0" encoding="UTF-8"?>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="_c5a0536fbcfe99304cf36b09980cba2c" IssueInstant="2014-05-01T06:18:46.289Z" Version="2.0">
<saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">https://idp.lms.ehime-u.ac.jp/idp/shibboleth</saml2:Issuer>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" NameQualifier="https://idp.lms.ehime-u.ac.jp/idp/shibboleth" SPNameQualifier="https://moo.chi.tokushima-u.ac.jp/shibboleth-sp">_6cea0e3fcf929c299bb09dacefa7edbb</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData Address="133.71.3.2" InResponseTo="_78531901ebd50b9b8c8bdfb9ae2fdc59" NotOnOrAfter="2014-05-01T06:23:46.289Z" Recipient="https://moo.chi.tokushima-u.ac.jp/Shibboleth.sso/SAML2/POST" />
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2014-05-01T06:18:4
@TakashiSasaki
TakashiSasaki / css.html
Last active December 22, 2017 01:13
Google Apps ScriptのHtmlServiceではviewportの指定が許されていないので高解像度のスマートフォンで閲覧するとフォーム要素がとても小さい。ワークアラウンドとしてスタイルにzoomを指定する。
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<style>
@media
(-webkit-min-device-pixel-ratio: 3),
(min-resolution: 3ppx){
form { zoom:4 }
}
@media