Skip to content

Instantly share code, notes, and snippets.

@matsuoshi
matsuoshi / assert.gs
Created February 3, 2025 08:56
assert for gas (google app script)
function assert(expected, actual) {
const at = (new Error()).stack.split('\n')[2].trim()
if (expected !== actual) {
console.error('error', {expected, actual}, at)
return false;
}
console.log('OK', {expected, actual}, at)
return true;
@matsuoshi
matsuoshi / gist:933ffd57e22dbbe4b199916fc309b4de
Last active September 28, 2024 01:06
xremap config (emacs like control-key)
modmap:
- name: modifiers
remap:
CapsLock: RightCtrl
Muhenkan:
held: LeftCtrl
alone: Muhenkan
keymap:
- name: Terminal
@matsuoshi
matsuoshi / regex.php
Created September 27, 2022 10:49
正規表現の uフラグ
<?php
$subjects = [
'zenkaku',
'hankaku',
'あいうえお'
];
foreach ($subjects as $subject) {
preg_match('/^[a-z]+$/', $subject, $match);
var_dump($match);
{
"title": "Japanese JIS to US Keyboard: Remap Symbol Keys",
"maintainers": [
"halfwhole"
],
"rules": [
{
"description": "Japanese JIS to US Keyboard: Remap Symbol Keys",
"manipulators": [
{
# from to
1 右space 無変換
2 無変換 WIN
3 WIN App
4 Caps L_CTRL
5 fn + Caps L_CTRL
6 FN L_CTRL
@matsuoshi
matsuoshi / eisuu-command.json
Last active July 14, 2022 01:12
karabiner, Eisuu to Command
{
"title": "Cmd-Eisuu-Kana",
"rules": [
{
"description": "cmd to eisuu and kana",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command",
@matsuoshi
matsuoshi / kensington-trackball.json
Last active June 21, 2022 03:02
Karabiner setting, for Kensington Trackball
{
"title": "for Kensington Trackball",
"rules": [
{
"description": "L_btn + R_btn to Button 2",
"manipulators": [
{
"type": "basic",
"from": {
"simultaneous": [
@matsuoshi
matsuoshi / .htaccess
Created February 3, 2019 02:14
Facebook / Twitter からのクロールを、BASIC認証下でも許可する
# FB / twitterクローラーを許可する
Satisfy Any
Order Allow,deny
SetEnvIf User-Agent "^facebookexternalhit.*$" sns_crawler
SetEnvIf User-Agent "^.*Twitterbot.*$" sns_crawler
Allow from env=sns_crawler
@matsuoshi
matsuoshi / browser.json
Created January 24, 2019 05:49
karabiner-elements setting: F5 to CMD+R key (browser only)
{
"title": "browser",
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.apple\\.Safari",
"^com\\.google\\.Chrome",
"^com\\.vivaldi\\.Vivaldi"
]