Skip to content

Instantly share code, notes, and snippets.

View kurone-kito's full-sized avatar
🐱
にゃーん

Kuroné Kito (黒音キト) kurone-kito

🐱
にゃーん
View GitHub Profile
@kurone-kito
kurone-kito / RotateMoveBehaviour.cs
Last active January 20, 2019 09:48
A behavior script for Unity: for moving an object in a rect shape by turning it at a right angle using a quaternion when outed a certain range.
using UnityEngine;
public class CubeBehavior : MonoBehaviour
{
const float threshold = 1f;
private readonly Quaternion quaternion = Quaternion.AngleAxis(90, Vector3.down);
public Vector3 direction = Vector3.forward * 0.1f;
// Update is called once per frame
@kurone-kito
kurone-kito / onBackHome.js
Created January 20, 2019 09:39
Script for AWS Lambda: To judge if at night and to pass the result to the Webhooks of IFTTT.
const https = require('https');
const ifttt = event => `https://maker.ifttt.com/trigger/${event}/with/key/${process.env.IFTTT_WEBHOOK_KEY}`;
exports.handler = async (event) => {
const time = new Date();
const valid = time.getHours() >= 18;
const eventId = valid ? 'night' : 'other';
await new Promise(r => https.get(ifttt(eventId), r));
const response = { statusCode: 200, body: eventId };

Keybase proof

I hereby claim:

  • I am kurone-kito on github.
  • I am kurone_kito (https://keybase.io/kurone_kito) on keybase.
  • I have a public key ASDWJqIZRqUlaz3xvg0NMErFxap5gwfMSqyg5obNmxr5RAo

To claim this, I am signing this object:

@kurone-kito
kurone-kito / gpdwin2.ahk
Created February 14, 2019 00:50
AutoHotKey settings for GPD WIN2
; 十字キー上:ホイール上
; 十字キー下:ホイール下
; 十字キー左:テンキーのページダウン
; 十字キー右: テンキーの左
; XYABボタン:キーボードの上下左右
; L3: テンキーのEnd
; R3: テンキーの下
NumpadPgDn::PgUp
NumpadLeft::PgDn
$now = Get-Date -Format "yyyyMMdd_HHmmss"
$target = "C:\Program Files\Docker\Docker\resources\MobyLinux.ps1"
Copy-Item $target ("{0}.{1}" -f $target, $now)
$data = Get-Content $target | ForEach-Object { $_ -replace "-ComputerName localhost", "" }
$data | Out-File $target
#!/bin/sh
mas upgrade
brew update
brew upgrade
npm update -g
npm upgrade -g
yarn global upgrade
brew cask upgrade
brew cleanup
@kurone-kito
kurone-kito / Piyo.d.ts
Last active June 14, 2019 06:14
🐥 Example of type solution using d.ts in JavaScript.
export interface PiyoInstance {
/**
* Thru an argument.
* @param x argument.
* @template T argument type.
*/
instanceMethod<T>(x: T): T;
}
/** 🐥 */
@kurone-kito
kurone-kito / groupByPrefix.ts
Last active June 19, 2019 01:55
Group duplicate prefixes in the strings: (src: string[]) => string[]
const getInitials = (src: string[], length = 1) =>
Array.from(new Set(src.map(v => v.substring(0, length))));
export default (src: string[]) =>
getInitials(src).map(initial => {
const list = src.filter(v => v.match(`^${initial}`));
const rec = (prev: string, length = 2): string => {
const [word, ...{ length: l }] = getInitials(list, length);
return l || list[0].length < length ? prev : rec(word, length + 1);
@kurone-kito
kurone-kito / GRAPHIG-kurone-kito.md
Last active May 12, 2021 02:08
グラフィグ黒音キト 頒布情報

黒音キト グラフィグ

私、黒音キトのグラフィグ制作キットを公開します。

CC-BY-NC ライセンスで無料頒布します。 出典明記・非営利目的 の二点だけ守っていただければ、改変・転載・再頒布など一切自由です。

折り線のあるバージョンとないバージョンがあります。折り線が気になる方は使い分けてみてください。


@kurone-kito
kurone-kito / minecraft-download.sh
Created March 1, 2021 04:51
A script to download the Minecraft world from the ScalaCube server for preview it in single play mode.
#!/bin/sh
# vim: set ft=sh:
set -eu
HOST=minecraft-scalacube.example.com
USER=backup
PORT=2017
SRC_ZIP=$(ssh -p ${PORT} ${USER}@${HOST} 'ls -t minecraft-2* | head -1')
DST_ZIP=$(mktemp -u).zip