Skip to content

Instantly share code, notes, and snippets.

@koseki
koseki / vbox-ch10-1.md
Last active September 14, 2021 01:18
VirtualBox はどこにファイルを保存するか

VirtualBox マニュアルメモ - 10.1. VirutalBox はどこにファイルを保存するか

10.1. Where VirtualBox stores its files

In VirtualBox, a virtual machine and its settings are described in a virtual machine settings file in XML format.

VM の設定は XML 形式で書いてある。

@koseki
koseki / README.md
Last active June 13, 2021 01:13
Dump RPM headers
@koseki
koseki / dump-rpm-headers.py
Last active June 12, 2021 12:22
Dump RPM headers
#! /usr/bin/env python
import struct
from ctypes import *
import io
import re
from enum import Enum
from sys import argv
@koseki
koseki / too-many-markers.md
Last active June 8, 2021 05:35
Google Maps に大量のマーカを表示する

Google Maps に大量のマーカを表示する - Too Many Markers!

のメモです。

Introduction

Some applications are required to display a large number of locations or markers. Despite the v3 JavaScript API's significant improvement to performance, naively plotting thousands of markers on a map can quickly lead to a degraded user experience. Too many markers on the map cause both visual overload and sluggish interaction with the map.

@koseki
koseki / dst.md
Last active April 23, 2021 01:32
サマータイム終了時の挙動

タイムゾーン America/Los_Angeles では、サマータイム終了日 2018/11/04 の 01:00:00 〜 01:59:59 が2度繰り返される。

Ruby の Time は、午前1時台をサマータイム終了後として扱っている。

irb(main):001:0> ENV['TZ'] = 'America/Los_Angeles'
=> "America/Los_Angeles"
irb(main):002:0> Time.local(2018, 11, 4, 0, 59, 0)
=> 2018-11-04 00:59:00 -0700
irb(main):003:0> Time.local(2018, 11, 4, 0, 59, 0).dst?
@koseki
koseki / index.js
Last active April 11, 2021 02:48
Memoized Async Function
import axios from 'axios'
class App {
constructor() {
this.cache = {}
}
/**
* 何もキャッシュしないバージョン
*/
@koseki
koseki / aioredis_reconnection.py
Last active January 4, 2021 10:17
aioredis Pub/Sub reconnection
import asyncio
from typing import List
import aioredis
from aioredis import Redis
from aioredis.pubsub import Channel
from aioredis.connection import RedisConnection
class Sample:
@koseki
koseki / README.md
Last active December 14, 2020 11:53
日本の市外局番と都道府県の対応 Phone Number Area Code and Prefectures in Japan
@koseki
koseki / README.md
Last active February 27, 2018 11:52
Windows VirtualBox Text File Busy

"Text file busy" error on Windows VirtualBox

While you opening a file in shared folder on Guest OS, you can't move or delete the file.

> vagrant up
> vagrant ssh
$ cd /vagrant
$ ./test.sh &
[1] 2656
@koseki
koseki / HTPasswd.php
Last active August 20, 2017 05:55
PHP - MD5 based htpasswd entry generator class
<?php
/**
* MD5 based htpasswd entry generator
*
* Original: https://stackoverflow.com/questions/2994637/how-to-edit-htpasswd-using-php/8786956#8786956
* Spec: https://httpd.apache.org/docs/2.4/misc/password_encryptions.html
*
*
* random_compat is required if you are using PHP < 7.0.