Skip to content

Instantly share code, notes, and snippets.

View grainrigi's full-sized avatar

Naoki Kiryu grainrigi

  • Leverages Co.,Ltd.
  • Tokyo, Japan
View GitHub Profile
@grainrigi
grainrigi / flannel-restore.sh
Last active April 13, 2020 10:07
flannel save/restore
#!/bin/bash
# Restore Flannel
DEVICE=flannel.1
# Load Config
source /tmp/.flannel-save || exit
# Restore link
ip l a "$DEVICE" type vxlan id 1 local 192.168.210.252 dstport 8472 dev wg0
@grainrigi
grainrigi / jsonBodyParser.ts
Created April 13, 2020 13:12
Express JSON Body Parser With Automatic Date Parsing
import expressBodyParser from 'body-parser';
const reISO = /^(?:[+-]\d{6}|\d{4})-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
function dateReviver(key: string, value: any): any {
if(typeof value === 'string') {
// ざっくりチェック
if((value.length === 24 || value.length === 27) && value.endsWith('Z')) {
if(reISO.exec(value)) return new Date(value);
}
@grainrigi
grainrigi / unprotected.vbs
Created April 28, 2020 01:38
VBAパスワードロック解除(64bit)
Option Explicit
Private Const PAGE_EXECUTE_READWRITE = &H40
Private Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As LongPtr, Source As LongPtr, ByVal Length As Long)
Private Declare PtrSafe Function VirtualProtect Lib "kernel32" (lpAddress As LongPtr, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As LongPtr) As Long
Private Declare PtrSafe Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As LongPtr
Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As LongPtr, ByVal lpProcName As String) As LongPtr
Private Declare PtrSafe Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As Long, ByVal pTemplateName As LongPtr, ByVal hWndParent As Long, ByVal lpDialogFunc As LongPtr, ByVal dwInitParam As Long) As Integer
Dim HookBytes(0 To 11) As Byte
Dim OriginBytes(0 To 11) As Byte