Skip to content

Instantly share code, notes, and snippets.

Sub 全シート行数カウント()
Dim sheetname As String
Dim i As Integer
For i = 1 To ThisWorkbook.Sheets.Count
sheetname = ThisWorkbook.Sheets(i).Name
ActiveCell = "=CountA('" & sheetname & "'!G6:G65535)"
ActiveCell.Offset(1, 0).Activate
Next
End Sub
@kshimi
kshimi / SQLで数値書式指定
Created March 21, 2013 06:18
SQLで数値書式指定
select to_char(123.12342145, 'TM9'), to_char(123784927348923.0010000, 'TM9') from dual
@kshimi
kshimi / repetation.bat
Created March 21, 2013 12:24
テキストファイル内容に基づきループ。
for /F "tokens=1,2,3" %%a in (abc.txt) do (
echo %%b %%a %%c
)
@kshimi
kshimi / FibNum.js
Last active August 3, 2016 05:27
JavaScriptによるフィボナッチ数列再帰版
// fibonacci number
alert(
(function(n) // nameless function 1
{ // nameless function1 body
return "1," + (f = function(a, b, n) // nameless function 2
{ // nameless function2 body
if (n == 0 )
{
return "";
}
@kshimi
kshimi / VisibleNames
Created December 25, 2013 06:56
Excelで非表示になっている「名前」を表示する
Public Sub VisibleNames()
Dim name As Object
For Each name In Names
If name.Visible = False Then
name.Visible = True
End If
Next
MsgBox "すべての名前の定義を表示しました。", vbOKOnly
End Sub
@kshimi
kshimi / gist:d0856f39e10a817de418
Created January 30, 2014 09:29
Excelで選択範囲に対し、表示上空欄に見える値をクリアして本当の空欄にする
Sub Macro1()
Dim i As Long
For i = 1 To Selection.Count
If Not IsEmpty(Selection(i)) Then
If Selection(i).Value = "(NULL)" Or _
Asc(Selection(i)) = -31871 Or _
Asc(Selection(i)) = 63 Then
Selection(i).ClearContents
End If
End If
@kshimi
kshimi / about_scoring_project.rb
Created May 26, 2014 13:32
Ruby koans Greed score sample
require File.expand_path(File.dirname(__FILE__) + '/neo')
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used to calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
@kshimi
kshimi / test_sample.rb
Created April 18, 2016 06:06
Test with STDIO
require 'minitest/autorun'
class TestMyClass < Minitest::Test
def setup
@orig_stdin = $stdin
@in = StringIO.new
$stdin = @in
end
@kshimi
kshimi / worktime.bat
Last active August 15, 2017 02:58
List recent startup and shutdown time from windows event log
@ruby -x "%~f0" %* & exit /b
#!ruby
# list recent startup and shutdown time
require 'tempfile'
require 'csv'
require 'date'
file = Tempfile.new('event')
CMD = "Get-EventLog System -After (Get-Date).AddMonths(-2) | Where-Object { $_.InstanceId -eq 12 -or $_.InstanceId -eq 13 } | Sort-Object TimeGenerated | Export-CSV #{file.path} -notype "
@kshimi
kshimi / .pryrc
Last active October 12, 2018 00:33
pryrc for inf-ruby(emacs) on windows
class Emacsable
def self.readline(prompt)
print prompt
(gets || '').chomp
end
end
Pry.config.input = Emacsable
Pry.config.pager = false