View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View index.html

ヤコビの反復法

use constant N => 3;

my @a = ([9,2,1,1],[2,8,-2,1],[-1,-2,7,-2],[1,-1,-2,6]);
my @b = (20,16,8,17);
my @c = (0,0,0,0);

# ヤコビ反復法
jacobi(\@a, \@b, \@c);
View DeleteNames.bas
Public Sub DeleteNames()
For Each nm In ActiveWorkbook.Names
Debug.Print nm.Name
nm.Delete
Next
End Sub
View gist:5881330

Project Euler を はじめから

4ヶ月もほったらかしになってたので、 復習がてら Problem 1 からやってみる。

F #

初項a、公差d の等差数列の初項から第n項 (末項 l=a+(n-1)d) までの和Snは...

let sn a lim =
  let n = lim / a in
  let l = a   * n in
View gist:5762183

Access で Oracle に ODBC 接続したときの文字化け

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient11g_home1\NLS_LANG

JAPANESE_JAPAN.JA16SJIS

を設定する

JA16EUC, AL16UTF8 だと ODBCエラーになって接続できなかった

View gist:5441435
Set fs = CreateObject("Scripting.FileSystemObject")
file = WScript.Arguments(0)
If WScript.Arguments.Count > 1 Then
dt = CDate(WScript.Arguments(1))
Else
dt = Now
End If
With CreateObject("Shell.Application")
With .NameSpace(fs.GetParentFolderName(file))
View gist:5440166
Option Explicit
Private fs: Set fs = WScript.CreateObject("Scripting.FileSystemObject")
Private folder: Set folder = fs.GetFolder(WScript.Arguments(0))
Private xl: Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.DisplayAlerts = False '警告メッセージをOFF
'ファイル一覧を取得
View gist:5440158
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var search_folder = WScript.Arguments(0);
var copy_folder = WScript.Arguments(1);
var mode = "";
if (WScript.Arguments.length > 2)
mode = WScript.Arguments(2);
if (mode == "")
WScript.Echo("confirm mode");
else if (mode == "c")
View gist:5368838
http://www.joshkunz.com/iTunesControl/main.html
View gist:5360901
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_EXTENDEDKEY As Long = &H1
Private Const KEYEVENTF_KEYUP As Long = &H2
Private Const VK_LMENU As Long = &HA4
Private Const VK_LCONTROL As Long = &HA2
Private Const fKEYDOWN = KEYEVENTF_EXTENDEDKEY
Private Const fKEYUP = KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP