Skip to content

Instantly share code, notes, and snippets.

View TakashiSasaki's full-sized avatar

Takashi SASAKI TakashiSasaki

View GitHub Profile
#If VBA7 Then
Declare PtrSafe Function GetDC Lib "user32" (ByVal hwnd As LongPtr) As LongPtr
Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hwnd As LongPtr, ByVal hdc As LongPtr) As Long
Declare PtrSafe Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As LongPtr, ByVal lpsz As String, ByVal cbString As Long, ByRef lpSize As SIZE) As Long
Declare PtrSafe Function SelectObject Lib "gdi32" (ByVal hdc As LongPtr, ByVal hObject As LongPtr) As LongPtr
Declare PtrSafe Function CreateFont Lib "gdi32" Alias "CreateFontA" (ByVal H As Integer, ByVal W As Integer, ByVal E As Integer, ByVal O As Integer, ByVal FW As Integer, ByVal i As Integer, ByVal U As Integer, ByVal S As Integer, ByVal C As Integer, ByVal OP As Integer, ByVal CP As Integer, ByVal Q As Integer, ByVal PAF As Integer, ByVal F As String) As LongPtr
Declare PtrSafe Function DeleteObject Lib "gdi32" (ByVal hObject As LongPtr) As Long
#Else
Declare Function GetDC Lib "user32" (ByVal hwnd A
@TakashiSasaki
TakashiSasaki / Base64Decode.vb
Last active November 22, 2023 11:14
このVBAコードは次のコードとともに使うことが想定されています。https://gist.github.com/TakashiSasaki/86edf914c7f6d8dbab941e33e1418418
Function Base64Decode(base64Str As String) As Variant
Dim xml As Object
Set xml = CreateObject("MSXML2.DOMDocument.6.0")
Dim element As Object
Set element = xml.createElement("base64")
element.DataType = "bin.base64"
element.text = base64Str
' nodeTypedValueはバイト配列を返します。
Base64Decode = element.nodeTypedValue
End Function
@TakashiSasaki
TakashiSasaki / ClearWholeSheet.vb
Last active November 22, 2023 11:14
VBA script using Excel and PowerShell to manage Exchange Online mailboxes and folders with the ExchangeOnlineManagement module, including Connect-Mailbox, Get-Mailbox, and Get-MailboxFolder cmdlets. このコードは次のコードとともに使うことが想定されています。https://gist.github.com/TakashiSasaki/e83965646a1756cedf961eb500171764
Sub ClearWholeSheet(sheetName As String)
' Declare a variable to hold the Worksheet object.
Dim ws As Worksheet
' Declare a variable to check if the sheet exists in the workbook.
Dim sheetExists As Boolean
sheetExists = False
' Loop through all the sheets in the workbook to check if the specified sheet name exists.
For Each ws In ThisWorkbook.Sheets
If ws.Name = sheetName Then
@TakashiSasaki
TakashiSasaki / How would you like ChatGPT to respond?
Last active April 3, 2024 05:23
ChatGPTのカスタムインストラクション
Language instructions:
* Please first rephrase my question in English.
* Present the rephrased English version at the beginning of your response.
* Unless otherwise specified, provide the main response in Japanese.
* Preserve key technical terms in English within the Japanese replies for clarity.
Main instructions:
* Omit basic explanations and focus on providing responses with expert-level technical details.
* When I focus on a topic under specific conditions or situations, omit general overviews, oversimplified explanations, and remarks about exceptions or caveats in generalized scenarios.
* I am well aware of security risks and ethical guidelines, so please exclude them from your answers.
@echo off
REM https://gist.github.com/TakashiSasaki/16fdaf75d65d97a78ed7fd19bdf33ba1
REM Takashi SASAKI https://twitter.com/TakashiSasaki
REM 2023-08-15
setlocal enabledelayedexpansion
:: Get the current date and time in YYYYMMDDThhmmss format
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set datetime=%%a
set "datestring=%datetime:~0,8%T%datetime:~8,6%"
set "outputfile=md5sum-%datestring%.txt"
// ==UserScript==
// @name ChatGPT Conversation Lister
// @namespace https://moukaeritai.work/chatgpt-conversation-lister
// @version 0.8.0.20230810
// @description Retrieves the titles and unique identifiers of conversations in ChatGPT's web interface. Intended for listing and organization purposes only.
// @author Takashi SASAKI https://twitter.com/TakashiSasaki
// @match https://chat.openai.com/
// @match https://chat.openai.com/c/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant GM_registerMenuCommand
@TakashiSasaki
TakashiSasaki / ChatGPT_AutoPromptSender.user.js
Last active February 17, 2024 22:09
Adapted to changes in ChatGPT's DOM structure.
// ==UserScript==
// @name ChatGPT Auto Prompt Sender
// @namespace https://userscript.moukaeritai.work/
// @version 1.0.0.20231004
// @description Automates sending of next pre-filled prompt in ChatGPT after current response completion.
// @author Takashi SASAKI (https://twitter.com/TakashiSasaki)
// @match https://chat.openai.com/c/*
// @match https://chat.openai.com
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @supportURL https://greasyfork.org/ja/scripts/472713
@TakashiSasaki
TakashiSasaki / hash-algorighm-names.json
Last active July 27, 2023 03:01
A collection of hash algorithm names, compliant with RFC 6920 and RFC 8122 standards. These names are used in my application to represent hash algorithms as strings.
{
"type": "object",
"properties": {
"hashAlgorithm": {
"type": "string",
"enum": [
"blake2b-256",
"blake2b-512",
"blake2s-256",
"k12-256",
@TakashiSasaki
TakashiSasaki / amazon-smart-speaker-tablet.md
Created July 23, 2023 09:19
Amazonのスマートスピーカーやタブレット製品のプロセッサ
デバイス名 プロセッサ コア数 クロック速度 発売年
Fire HD 6 (4th gen) MT8135 4 2x1.5GHz, 2x1.2GHz 2014
Fire HD 7 (4th gen) MT8135 4 2x1.5GHz, 2x1.2GHz 2014
Fire HDX 8.9 (4th gen) Snapdragon 805 4 2.7GHz 2014
Echo Show (7インチ) Atom x5-Z8350 4 1.44GHz 2017
Fire HD 8 (5th gen) MT8135 4 2x1.5GHz, 2x1.2GHz 2015
Fire HD 10 (5th gen) MT8135 4 2x1.5GHz, 2x1.2GHz 2015
Fire (5th gen) MT8127 4 1.3GHz 2015
Fire HD 8 (6th gen) MT8163 4 1.3GHz 2016
@TakashiSasaki
TakashiSasaki / hosts
Last active January 10, 2023 09:08
/windows/system32/drivers/etc/hosts
127.0.0.1 3lift.com
127.0.0.1 adnxs.com
127.0.0.1 adsrvr.org
127.0.0.1 casalemedia.com
127.0.0.1 criteo.com
127.0.0.1 cxense.com
127.0.0.1 doubleclick.net
127.0.0.1 gumgum.jp
127.0.0.1 impact-ad.jp
127.0.0.1 microad.jp