Skip to content

Instantly share code, notes, and snippets.

View guitarrapc's full-sized avatar
:octocat:

Ikiru Yoshizaki guitarrapc

:octocat:
View GitHub Profile
notAfter=Jan 28 12:00:00 2028 GMT
subject=C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
notAfter=Dec 15 08:00:00 2021 GMT
subject=OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
notAfter=Jul 24 14:15:12 2029 GMT
subject=O = Entrust.net, OU = www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU = (c) 1999 Entrust.net Limited, CN = Entrust.net Certification Authority (2048)
notAfter=May 12 23:59:00 2025 GMT
subject=C = IE, O = Baltimore, OU = CyberTrust, CN = Baltimore CyberTrust Root
notAfter=Nov 27 20:53:42 2026 GMT
@guitarrapc
guitarrapc / run.sh
Last active August 23, 2023 02:57
Use verdaccio contains wget to health check container.
#!/bin/bash
set -e
# run container
containerId=$(docker run -d --rm -p 4873:4873 verdaccio/verdaccio:5.24.0)
# health check should success
wget -q -O - http://localhost:4873/-/ping || exit 1
# kill container
@guitarrapc
guitarrapc / README.md
Created August 8, 2023 08:34
Install selected component of Visual Studio Installer.

WHAT IS THIS?

Install Visual Studio Installler's CMake via setup.exe.

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --quiet --force --norestart --productId "Microsoft.VisualStudio.Product.BuildTools" --channelId "VisualStudio.17.Release" --add "Microsoft.VisualStudio.Component.VC.CMake.Project"

Progress

@guitarrapc
guitarrapc / Install-WinGetWindowsSErver2022.ps1
Last active August 9, 2023 09:38
Download and install winget v1.5.1881 to Windows Server 2022
# download
curl.exe -sSf -L -o "$env:UserProfile/Downloads/Microsoft.UI.Xaml.2.7.x64.appx" https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx
curl.exe -sSf -L -o "$env:UserProfile/Downloads/Microsoft.VCLibs.x64.14.00.Desktop.appx" https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx
curl.exe -sSf -L -o "$env:UserProfile/Downloads/winget-cli.v1.5.1881.msixbundle" https://github.com/microsoft/winget-cli/releases/download/v1.5.1881/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
curl.exe -sSf -L -o "$env:UserProfile/Downloads/winget-cli-c6bee58ade21451eb54dc52e559a314c_License1.v1.5.1881.xml" https://github.com/microsoft/winget-cli/releases/download/v1.5.1881/c6bee58ade21451eb54dc52e559a314c_License1.xml
# install
Add-AppxPackage -Path "$env:UserProfile/Downloads/Microsoft.UI.Xaml.2.7.x64.appx"
Add-AppxPackage -Path "$env:UserProfile/Downloads/Microsoft.VCLibs.x64.14.00.Desktop.appx"
Add-AppxPackage -Path "$env:UserProfile/Downloads/winget-cli.v1.5.18
@guitarrapc
guitarrapc / README.md
Last active July 31, 2023 05:20
[Markdown] An option to highlight a "Note" and "Warning" using blockquote (Beta) https://github.com/orgs/community/discussions/16925

New (2023/July/28)

> [!NOTE]  
> Highlights information that users should take into account, even when skimming.

> [!IMPORTANT]  
> Crucial information necessary for users to succeed.

> [!WARNING]  
@guitarrapc
guitarrapc / README.md
Created July 3, 2023 18:42
git clone + submodule clone with shallow-clone difference.
command clone depth submodule depth total sec
--depth + submodule --depth 1 1 125sec
--depth --single-branch + submodule depth 1 1 127sec
--depth --single-branch --recursive 1 1 109sec
--depth + submodule --depth 100 1 126sec
--depth --single-branch + submodule depth 100 1 114sec
--depth --single-branch --recursive 100 100 107sec
--depth + submodule --depth 100 100 102sec
--depth --single-branch + submodule depth 100 100 108sec
@guitarrapc
guitarrapc / README.md
Last active June 22, 2023 15:05
Minimum sample of IAM User MFA input on awscli. This is same pattern of switch role to same account.

README

  1. Terraformを実行して IAM user a-user と IAM Role mfa-roleを作成します。 a-usermfa-role にAssumeRoleできます。mfa-role は 同一アカウントからの AssumeRoleを許可しますが利用には mfaが必須です。mfa-role は S3 へのフルアクセスを持っています。
  2. ~/.aws/credentials を作成します。 ~/.aws/credentials の a-user プロファイルは IAM User a-user の aws access/secretkey の入力に使います。
  3. ~/.aws/config を作成します。 ~/.aws/config で、 mfa-role プロファイルは、a-user から mfa-role にAssumeRoleし利用すること。mfa-role が求めるmfaに mfa_serialで指定した に IAM User a-user の仮想MFAデバイスのarnを使うことを宣言します。mfa_serial によって、aws cli はmfaが必要な時に自動的にプロンプトを行います。

準備ができました。aws cli で mfa-role プロファイルとして s3一覧取得を実行しましょう。 コマンドを実行すると、.aws/config で指定した IAM User の MFAデバイスのパスコード入力が求められます。TOTP を入力すると、IAM Role mfa-role に付与されたポリシーに従って S3 バケットのリストを列挙します。 S3 アクセス権限は IAM User a-user にはなかったので、mfa-role に AssumeRole され、また MFA が必須になっていることがわかります。

@guitarrapc
guitarrapc / BlittableBool.cs
Created June 21, 2023 07:07
C# bool is not Blittable. Instead, use byte or wrap byte to offer BlittableBool.
public struct BlittableBool
{
public readonly byte Value;
public BlittableBool(byte value)
{
Value = value;
}
public BlittableBool(bool value)
@guitarrapc
guitarrapc / FontInstaller.cs
Last active May 31, 2023 19:53
Windows Font installer. Install Fonts to System Font, and use it without Windows restart.
using Microsoft.Win32; // use NuGet Microsoft.Win32.Registry
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
public static class FontNative
{
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
@guitarrapc
guitarrapc / README.md
Created May 15, 2023 09:30
Reids Cluster on docker

Subscribe

docker compose exec redis /bin/bash
redis-cli -h redis-node-5 -a bitnami -c
> ssubscribe sfoo
> ssubscribe sbar

Publish