Skip to content

Instantly share code, notes, and snippets.

@MakotoUwaya
MakotoUwaya / React + Vite Getting Started
Created March 21, 2023 10:37
Create new react codebase from template.
npm create vite@latest test -- --template react-ts
cd test/
npm i
@MakotoUwaya
MakotoUwaya / retrievingFilesRecursively.ts
Last active December 2, 2020 12:46
Retrieving files recursively for nodejs with flatMap(ES2019)
import fs from 'fs';
const targetDirectoryPath = 'directoryPath';
const listFiles = (dir: string): string[] => {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap(dirent => {
const path = `${dir}/${dirent.name}`;
return dirent.isFile() ? [path] : listFiles(path);
});
};
console.log(listFiles(targetDirectoryPath));
@MakotoUwaya
MakotoUwaya / JenkinsSettingsBackup.ps1
Last active July 6, 2017 01:15
Jenkins 設定バックアップ PowerShell版
# 変数定義
Set-Location ..
$JenkinsHome = (Convert-Path ..)
Set-Location (".\" + $ENV:JOB_NAME)
$HostPcName = $env:COMPUTERNAME.ToLower()
$BackupPath = $env:UserProfile + "\Documents\business-app-jenkins-backup"
$ArchivePath = $HostPcName + "\jenkins-backup"
# ファイルのクリア
Remove-Item -Path ($BackupPath + "\" + $HostPcName) -Recurse -Force
@MakotoUwaya
MakotoUwaya / jenkins_setting_backup.cmd
Created July 5, 2017 09:33
Jenkinsの設定をバックアップ Windowsバッチコマンド版
@ECHO OFF
REM 変数定義
REM 第1引数(%1) バックアップファイル保存先ディレクトリ
SET JENKINS_HOME=%~dp0\..
SET HOST_PC_NAME=%COMPUTERNAME%
FOR %%I IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO (
CALL SET HOST_PC_NAME=%%HOST_PC_NAME:%%I=%%I%%
)
@MakotoUwaya
MakotoUwaya / tether_settings.md
Created April 2, 2017 13:08
Docomo MVNO tether settings. ドコモ MVNO SIMカード利用時 テザリング設定

For Xperia SO-01F (Android 4.4.2)

  1. Connected device to windows pc at debug mode.
  2. Use adb.exe shell command.
  3. Input this command.
cd "C:\Program Files (x86)\Android\android-sdk\platform-tools"
adb shell
settings put global tether_dun_required 0
settings put global tether_dun_required 1
settings put global tether_dun_required 0
using (var db = new entities())
{
var results = from p in (
from p in db.products
where p.Price > 0
select p).ToList()
select Products.List(p);
return results.ToList();
}
using System.Threading.Tasks;
using MyCompany.Common.Wcf;
namespace MyCompany.Common.Controller
{
public static class Item
{
/// <summary>
/// 商品情報を取得する
/// </summary>
@MakotoUwaya
MakotoUwaya / Form1.vb
Last active December 2, 2020 12:44
Tasks UI Invoke Sample
Public Class Form1
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.F8
Dim fc As New FormController()
fc.AsyncAction(Me)
End Select
End Sub
Imports System.IO
Imports System.Net
Imports System.Net.Http
Imports System.Net.Http.Headers
Public Class Form1
''' <summary>
''' 接続先URL
''' </summary>
''' <remarks>固定値</remarks>
@MakotoUwaya
MakotoUwaya / MailOperation.vb
Last active October 19, 2015 05:51
VB System.Net.Mail.MailMessage Sample
''' <summary>
''' メール送受信クラス
''' </summary>
''' <remarks></remarks>
Public Class MailOperation
''' <summary>
''' SMTPサーバ DNS
''' </summary>