Skip to content

Instantly share code, notes, and snippets.

View chitoku-k's full-sized avatar
🐱
Becoming a cat

Chitoku chitoku-k

🐱
Becoming a cat
View GitHub Profile
@chitoku-k
chitoku-k / main.go
Created March 25, 2024 08:29
Create a file with its filename including an ill-formed UTF-16 on Windows
package main
import (
"fmt"
"golang.org/x/sys/windows"
)
func main() {
filename := []uint16{0xD800, 0x00}
@chitoku-k
chitoku-k / main.go
Created November 15, 2023 07:52
Invoke Win32_Process::Create using github.com/go-ole/go-ole
package main
import (
"fmt"
"runtime"
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
"golang.org/x/sys/windows"
)
@chitoku-k
chitoku-k / main.go
Last active September 6, 2023 03:31
Pause the console using GetConsoleProcessList to determine whether process is started by explorer.exe
//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zmain_windows.go main.go
//sys GetConsoleProcessList(processList []uint32) (processCount uint32, err error)
//sys SetConsoleTitle(consoleTitle string) (err error) = SetConsoleTitleW
package main
import (
"bufio"
"fmt"
"os"
@chitoku-k
chitoku-k / README.md
Last active October 25, 2020 14:50
restart.bash

使い方

ファイルが更新されたときに実行したいコマンドをあとに続ける

./restart.bash php server.php
@chitoku-k
chitoku-k / preloader.js
Created December 12, 2018 19:07
Component loading through text template
define('sample.vue', [], '<template></template>');
httpVueLoader._httpRequest = httpVueLoader.httpRequest;
httpVueLoader.httpRequest = function (url) {
if (!require.defined(url)) {
return httpVueLoader._httpRequest.apply(this, arguments);
}
new Promise(function (resolve, reject) {
require([ url ], function (template) {
@chitoku-k
chitoku-k / document-pollution.html
Last active October 20, 2018 17:19
Who owns document.title?
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>タイトルです</title>
</head>
<body>
<form name="head"></form>
<form name="title"></form>
<form name="body"></form>
@chitoku-k
chitoku-k / lb-transition.sh
Created May 14, 2018 14:25
Send a Slack notification when load-balance status has been updated (for EdgeRouter)
#!/bin/bash
RUN=/opt/vyatta/bin/vyatta-op-cmd-wrapper
# Slack Webhook
HOOK_URL=''
# Arguments
GROUP=$1
INTF=$2
STATUS=$3
@chitoku-k
chitoku-k / v6plus.php
Last active April 29, 2018 03:46
MAP-E のアドレス変換器(PHP >= 7.1.0)
<?php
// https://qiita.com/mpyw/items/0fdffd3c70b3abd802f5
function array_group_by_range(array $array, $separator = '-')
{
sort($array, SORT_NUMERIC);
$pairs = $ranges = [];
foreach (array_values(array_unique($array, SORT_NUMERIC)) as $i => $v) {
$pairs[$v - $i][isset($pairs[$v - $i])] = $v;
}
<template>
<article>{{ message }}</article>
</template>
<script lang="babel">
module.exports = {
computed: {
...Vuex.mapState([
'message',
]),
doruȝ-
dorw
dorwe
dorwgh
dourȝh
drowgȝ
durghe
durwe
-thogh
thorch