— ソフトウェア —
【Python】
【Python】簡単にローカルHTTPサーバーを立ち上げてWebページを確認する方法
【Python】簡単にローカルHTTPサーバーを立ち上げてWebページを確認する方法
時短テクニック エクセルショートカット!
・Mailman
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim strFILE As String Const EXCEL = """" & "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" & """" Const PARAM = "/t" strFILE = """" & Range(Target.Columns.Address).Text & """" Application.DisplayAlerts = False Call Shell(EXCEL & Space(1) & PARAM & Space(1) & strFILE) Application.DisplayAlerts = True Cancel = True End Sub |
・SD破損に備えて、RaspberryPiのディスクイメージを保存しよう! —Win32 Disk Imager AWS S3をWindowsのローカルストレージのように扱える「WinCse」
・Flutterアプリ
・コマンドチート
for文 書き方(6つの例)
<目次> ・grep コマンドの構文 ・オプション ※順不同 grep -v :指定した検索パターンを含まない(除外した)行を表示する。 grep -n :行番号をつけて表示する。 grep -i :大文字と小文… もっと読む grep コマンド
・シェルスクリプトで sqlplus から SQL を実行する時のお作法をあれこれ整理してみる
|
1 2 3 4 5 6 7 8 9 |
DUMMY1=’abc’ DUMMY2=999 sqlplus / as sysdba<<EOF var vTEST1 varchar2(10) var vTEST2 number select '${DUMMY}' into :vTEST1 from dual; select ${DUMMY2} into :vTEST2 from dual; EOF |
VBA情報
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
Option Explicit Private mOraSession As Object Private mOraDatabase As Object Private Sub InsOra() Dim dblTotal As Double Dim lngIn As Long Dim lngOu As Long Dim lngTrans As Long Dim strSQL As String Dim strBuf As String On Error GoTo ERR_HND Const strBASE As String = "INSERT INTO TEST002 VALUES (" Set mOraSession = CreateObject("OracleInProcServer.XOraSession") Set mOraDatabase = mOraSession.OpenDatabase("mura", "mura/mura", 0&) On Error Resume Next mOraSession.BeginTrans ' mOraDatabase.ExecuteSQL ("BEGIN TRANS") For lngOu = 1 To 10 For lngIn = 0 To 10000 dblTotal = dblTotal + 1 Debug.Print dblTotal If lngTrans = 1000 Then mOraSession.CommitTrans mOraSession.BeginTrans lngTrans = 0 End If lngTrans = lngTrans + 1 ' strBuf = Int((Int((lngOu * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((10 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((4 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((9 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((5 * Rnd) + lngIn) * Rnd) + lngIn) strBuf = Int((Int((lngOu * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((5 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((9 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((4 * Rnd) + lngIn) * Rnd) + lngIn) _ & Int((Int((10 * Rnd) + lngIn) * Rnd) + lngIn) 'Debug.Print Left$(strBuf, 5) strBuf = Left$(strBuf, 5) strSQL = "'" & strBuf & "'," _ & "'" & Left$("B2-" & lngIn & String(10, "0"), 10) & "'," _ & "'" & Left$("B3-" & lngIn & String(10, "0"), 10) & "'," _ & "'" & Left$("B4-" & lngIn & String(10, "0"), 10) & "'," _ & "'" & Left$("B5-" & lngIn & String(10, "0"), 10) & "')" mOraDatabase.ExecuteSQL (strBASE & strSQL) If Error <> 0 Then ' Beep Err.Clear End If Next lngIn Next lngOu mOraSession.CommitTrans ERR_HND: On Error Resume Next Beep Err.Clear End Sub |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
Option Explicit Sub GetFileList(ByRef objFSO As Object, _ ByRef FileList As Collection, _ ByVal FolderPath As String) 'フォルダの存在確認 If Not objFSO.FolderExists(FolderPath) Then MsgBox ("指定のフォルダは存在しません") Exit Sub End If '再帰処理モジュールのコール Call GetDirFiles(objFSO.GetFolder(FolderPath), FileList) End Sub Sub GetDirFiles(ByRef objFolder As Object, _ ByRef FileList As Collection) Dim objFSO As Object Dim objFile As Object Dim objFolderSub As Object Set objFSO = CreateObject("Scripting.FileSystemObject") 'サブフォルダの取得 For Each objFolderSub In objFolder.SubFolders ' Debug.Print objFolderSub.Name Call GetDirFiles(objFolderSub, FileList) Next 'ファイルの取得 For Each objFile In objFolder.Files With objFile If Left$(objFile.Name, 1) = "~" Then Else FileList.Add objFile.ParentFolder & "\" & objFile.Name End If End With Next 'オブジェクトの解放 Set objFolderSub = Nothing Set objFile = Nothing End Sub Sub 実行_Click() Dim ScrString As String Dim desString As String Dim strTime As String Dim dupuli As Boolean Dim curRow As Integer Dim SheetCnt As Long Dim FileCnt As Long Dim FindCnt As Long Dim PlotCnt As Long Dim wb As Workbook Dim mainWs As Worksheet Dim curWs As Worksheet Dim TargetRange As Range Dim FoundCell As Range Dim FirstCell As Range Dim PlotMsg As Collection Dim FileList As Collection Dim WordApp As Object Dim WordDoc As Object Dim objFSO As Object Const strRow As Integer = 12 Const strCol As Integer = 4 Set objFSO = CreateObject("Scripting.FileSystemObject") Set mainWs = Worksheets("検索") Set FileList = New Collection Set WordApp = CreateObject("Word.Application") strTime = Time ScrString = mainWs.Range("C4") desString = mainWs.Range("C6") mainWs.Range("B" & strRow & ":XFD10000").Clear dupuli = (mainWs.Range("C6") = "あり") curRow = strRow Call GetFileList(objFSO, FileList, mainWs.Range("C2")) For FileCnt = 1 To FileList.Count mainWs.Cells(curRow, 2) = curRow - (strRow - 1) mainWs.Cells(curRow, 3) = objFSO.GetFileName(FileList(FileCnt)) Set PlotMsg = New Collection If Left$(objFSO.GetExtensionName(FileList(FileCnt)), 3) = "doc" Then ' ワード Set WordDoc = WordApp.Documents.Open(FileList(FileCnt)) 'WordApp.Visible = True FindCnt = 0 With WordDoc.Content.Find .Text = ScrString Do .Forward = True .Execute If .Found = False Then Exit Do Else FindCnt = FindCnt + 1 End If Loop End With WordDoc.Close Set WordDoc = Nothing If FindCnt = 0 Then Call AddCollect(PlotMsg, "-") Else Call AddCollect(PlotMsg, Trim(FindCnt)) End If ElseIf Left$(objFSO.GetExtensionName(FileList(FileCnt)), 3) = "xls" Then Application.ScreenUpdating = False ' ファイルオープン Set wb = Workbooks.Open(FileList(FileCnt)) mainWs.Cells(curRow, strCol) = "-" mainWs.Cells(10, 3) = strTime & " ~ " DoEvents For SheetCnt = 1 To wb.Sheets.Count If wb.Worksheets(SheetCnt).Name = "変更履歴" Then Else Set curWs = wb.Worksheets(SheetCnt) If Right$(wb.Name, 4) = "xlsx" Then Set TargetRange = curWs.Range("A1", "XFD10000") Else Set TargetRange = curWs.Range("A1", "IV10000") End If ' 検索(部分一致) Set FoundCell = TargetRange.Find(What:=ScrString, LookAt:=xlPart) If FoundCell Is Nothing Then Else Set FirstCell = FoundCell Do '検索 FoundCell.Value = desString Call AddCollect(PlotMsg, "'" & curWs.Name, dupuli) ' 次を検索 Set FoundCell = TargetRange.FindNext(FoundCell) If FoundCell Is Nothing Then Exit Do Else If FoundCell.Address = FirstCell.Address Then Exit Do Else Call AddCollect(PlotMsg, "'" & curWs.Name, dupuli) End If End If Loop End If End If Next SheetCnt ' 終了 Application.DisplayAlerts = False wb.Close SaveChanges:=False Application.DisplayAlerts = True Else ' Excel/Word以外 Call AddCollect(PlotMsg, "-") With mainWs .Cells(curRow, 2).Font.Color = vbRed .Cells(curRow, 3).Font.Color = vbRed .Cells(curRow, 4).Font.Color = vbRed End With Application.DisplayAlerts = True End If ' 結果出力 Application.ScreenUpdating = True DoEvents If PlotMsg.Count = 0 Then Else For PlotCnt = 1 To PlotMsg.Count mainWs.Cells(curRow, strCol + (PlotCnt - 1)) = PlotMsg(PlotCnt) Next End If curRow = curRow + 1 Set FoundCell = Nothing Set FirstCell = Nothing Set TargetRange = Nothing Set curWs = Nothing Set wb = Nothing Next FileCnt mainWs.Cells(10, 3) = strTime & " ~ " & Time Set mainWs = Nothing Set objFSO = Nothing Set FileList = Nothing Set WordApp = Nothing MsgBox "作業が完了しました。" End Sub Private Sub AddCollect(ByRef chkCol As Collection, _ ByRef chkStr As String, _ Optional ByVal dupuli As Boolean = False) Dim i As Long Dim MatchStr As Boolean If dupuli Then chkCol.Add chkStr Else For i = 1 To chkCol.Count If chkCol(i) = chkStr Then MatchStr = True Exit For End If Next If MatchStr Then Else chkCol.Add chkStr End If End If End Sub |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
Public Function GetFile(ByRef strFileName As String, _ ByRef strBuf As String) As Boolean GetFile = False On Error GoTo GetFile_ErrHnd Screen.MousePointer = 11 Dim intFNum As Integer 'ファイル番号 Dim strBuf As String Dim strGet As String intFNum = FreeFile 'ファイル番号取得 If Len(Dir(strFileName)) = 0 Then 'ファイルの存在を確認 MsgBox strFileName & vbCr _ & "ファイルが見つかりません!", vbOKOnly + vbCritical, "FileRead" GoTo FileRead_Exit End If Open strFileName For Input As #intFNum '読み込み用ファイルを開く Do While Not EOF(intFNum) 'データ取得 Line Input #intFNum, strGet 'データの読込 strBuf = strBuf & strGet & vbCrLf Loop Close #intFNum 'ファイルを閉じる strBuf = Left$(strBuf,Left$(strBuf,Len(strBuf)-2)) GetFile = True GetFile_Exit: Screen.MousePointer = 0 On Error Resume Next Close #intFNum 'ファイルを閉じる exit function GetFile_ErrHnd: MsgBox Err.Number & ":" & Error$, vbOKOnly + vbCritical, "GetFile" resume FileRead_Exit End Function |
[cray… もっと読む VBA
主なオプション オプション 説明 -t [[CC]YY]MMDDhhmm[.ss]の書式に則り、タイムスタンプを指定した日時に更新します。 -d 日時を文字列で指定して、タイムスタンプを更新します。 -c 存在しないファ… もっと読む touch
【Linuxコマンド集】find
|
1 2 3 4 5 6 7 8 9 10 11 |
find . -name "fil*" -atime 30 x日以内 find . -name "fil*" +atime 30 x日以前 find . -name "fil*" -mmin -30 x分以内 find . -name *.log -type f -atime 1 説明 使用方法 ~日より前に更新されたファイルを検索する場合 ⇒「+」を 指定する日数の前に入れる ~日以内に更新されたファイルを検索する場合 ⇒「-」を 指定する日数の前に入れる https://academy.gmocloud.com/wp/lesson/20191213/8268 |
|
1 2 3 4 5 6 7 8 |
#!/bin/bash while : do echo "test" sleep 3 loop done |
|
1 |
while :; do date; sleep 3; done |
|
1 2 3 4 5 6 7 8 9 |
#!/usr/bin/bash # echo "avaiable">status if [ $(cat status | grep -c "avaiable") -eq 1 ] || [ $(cat status | grep -c "enable") -eq 1 ]; then echo ok else echo ng fi |
#shell