Skip to content

Instantly share code, notes, and snippets.

View hymkor's full-sized avatar

HAYAMA_Kaoru hymkor

View GitHub Profile
@hymkor
hymkor / make.cmd
Created September 29, 2019 07:10
Goの amd64/386 , windows/linux のバイナリパッケージを全部作るバッチファイル
@setlocal
@set "PROMPT=%0> "
@call :"%1"
@endlocal
@exit /b
:""
:"package"
for %%I in (386 amd64) do call :package1 windows %%I .exe
for %%I in (386 amd64) do call :package1 linux %%I
@hymkor
hymkor / sqldbtest.go
Created September 27, 2019 05:39
SQL Server へ接続してみるテスト(業務ワードは「...」に書き換えたので、修正が必要です)
package main
import (
"context"
"database/sql"
"fmt"
_ "github.com/denisenkom/go-mssqldb"
)
@hymkor
hymkor / MSSQLDB.vb
Created September 27, 2019 04:59
SQL Server 接続のラッパーライブラリ(VBNet)
Imports System.Data.SqlClient
Public Class MSSQLDB
Implements IDisposable
'*** for example ***
'Using conn As New MSSQLDB("Initial Catalog=...;Data Source=taiyodenki;Server=...;UID=...;PWD=...")
' Using res = conn.Query("SELECT * FROM T_FOO")
' While res.Read()
' Console.WriteLine("Serial={0}", res.GetInt32(0))
@hymkor
hymkor / progress.go
Created May 14, 2019 00:52
c := Progress ; defer c() すると、現在の関数が終了するまで端末でスラッシュが回転するだけの関数
package nodos
import (
"fmt"
"time"
)
var clockmark = []rune{'-', '\u2216', '|', '/'}
func Progress() func() {
@hymkor
hymkor / junction_run.go
Created March 24, 2019 00:31
Go で Windows のジャンクションを作ろうとしているけれども、なんかうまくいかないソース
package main
import (
"os"
"unsafe"
"errors"
"golang.org/x/sys/windows"
"golang.org/x/xerrors"
)
@hymkor
hymkor / getconsolemode.go
Created December 31, 2018 13:36
現在のコンソールのモードを確認する(git.exe が push 時に勝手に変えてそうだったので)
// +build ignore
package main
import (
"fmt"
"os"
"golang.org/x/sys/windows"
)
@hymkor
hymkor / check.ps1
Created December 31, 2018 13:00
Print VersionInformation of Windows Executables
# check.ps1
$v = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($Args[0])
if( $v ){
Write-Host("FileVersion(StringFileInfo)=",$v.FileVersion)
Write-Host(" FileMajorPart(FixedFileInfo)=",$v.FileMajorPart)
Write-Host(" FileMinorPart(FixedFileInfo)=",$v.FileMinorPart)
Write-Host(" FileBuildPart(FixedFileInfo)=",$v.FileBuildPart)
Write-Host(" FilePrivatePart(FixedFileInfo)=",$v.FilePrivatePart)
Write-Host("ProductVersion(StringFileInfo)=",$v.ProductVersion)
@hymkor
hymkor / version.go
Created December 26, 2018 21:19
Windows のバージョンチェック → しかし、Windows10 は認証されていないコードには Windows 8と名乗ってしまうから意味なかったー
package dos
import (
"syscall"
"unsafe"
)
const (
verBuildNumber = 0x0000004
verMajorVersion = 0x0000002
@hymkor
hymkor / strict.lsp
Last active May 31, 2018 22:15
(strict "ソース名") … 変数宣言されていない変数に setq していたら表示する
; S式の中から、未宣言の変数を検索する
; vars - 宣言済み変数のリスト
; s-exp - S式
; returns
; 未宣言の変数のリスト
(defun strictsub (vars s-exp / warnings word add-warn test-var call-self eval-rest)
(setq warnings nil)
(setq add-warn (lambda (x)
(setq warnings (cons x warnings))
@hymkor
hymkor / DictExtension.vb
Created February 23, 2018 10:19
If Not dic1.TryGetValue(key1,val1) Then val1 = New Foo が多すぎて困る
Imports System.Runtime.CompilerServices
Module DictExtension
<Extension()>
Public Function GetOr(Of K, V)(ByVal dict As IDictionary(Of K, V), key As K, ByVal f As Func(Of V)) As V
Dim val As V = Nothing
If Not dict.TryGetValue(key, val) Then
val = f()
dict.Add(key, val)
End If