Skip to content

Instantly share code, notes, and snippets.

View kosugi's full-sized avatar

KOSUGI Tomo kosugi

  • tokyo.japan
View GitHub Profile
#! /bin/bash
echo '吉高由里子かわいい'
@kosugi
kosugi / terminal.json
Created October 21, 2017 08:58
Karabiner-Elements modifier for basic cmdline editing with meta-key
{
"title": "Terminal",
"rules": [
{
"description": "make editing easier on terminal applications",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "f",
*[aria-label="Footer"] {
display: none;
}
header[role="banner"] {
display: none;
}
*[data-testid="sidebarColumn"] {
display: none;
}
body, *[data-testid="primaryColumn"] {
from itertools import permutations
f = lambda xs: g(xs[0], xs[1] * 10 + xs[2], xs[3], xs[4] * 10 + xs[5], xs[6], xs[7] * 10 + xs[8])
g = lambda a, b, c, d, e, f: a * d * f + b * c * f + b * d * e == b * d * f
h = lambda xs: tuple(sorted([(xs[0], xs[1] * xs[2]), (xs[3], xs[4] * xs[5]), (xs[6], xs[7] * xs[8])]))
print(set(map(h, filter(lambda xs: f(xs), permutations(range(1, 10))))))
; https://qiita.com/mattn/items/ae764601862b0073071e
(use gauche.sequence)(fold-with-index(lambda(n a c)(string-append c a(if(< 1 n)"ー" "")))""(shuffle '("ボ" "ジョ" "レ" "ヌ" "ボ")))
;;
;; macOS の「次のウィンドウを操作対象にする」を実現するための AutoHotkey Script
;;
;; active window が属する process の window 群の中で,
;; active window の window handle が次に大きい (かつ UI を持つ) window を focus する.
;;
;; is_asc が false の場合は「次に小さい」 window を対象とする.
;;
;; TODO: 「UI を持つ」判定に window style を用いているが確証が無い
;;
xs = '''
11100011 10000010 10101000 11100011 10000011 10110011 11100011 10000010 10111000
11100011 10000011 10001011 11100011 10000010 10100010 11100011 10000000 10000001
11100011 10000011 10000111 11100011 10000010 10110110 11100011 10000010 10100100
11100011 10000011 10001010 11100011 10000011 10111100 11100101 10001011 10011111
11101001 10011011 10000110 11100011 10000001 10010111 11100011 10000001 10100110
11100011 10000001 10111110 11100011 10000001 10011001 00101110 00001010 11100011
10000010 10000001 11100011 10000001 10100011 11100011 10000001 10100001 11100011
10000010 10000011 11100110 10100101 10111101 11100011 10000001 10010111 11100011
10000001 10000100 11100100 10111011 10010101 11100100 10111010 10001011 11100011
@kosugi
kosugi / open-in-scanner.user.js
Last active June 9, 2022 09:06
IITC Plugin: Open In Scanner
// ==UserScript==
// @id iitc-plugin-open-in-scanner
// @name IITC plugin: Open in Scanner
// @category Portal Info
// @version 0.0.0
// @namespace https://twitter.com/kosugip
// @description Add “OpenInScanner” llink to portal info.
// @author kosugip
// @include https://*.ingress.com/intel*
// @include http://*.ingress.com/intel*
# -*- coding: utf-8 -*-
import itertools
def is_conflicted(qs, x ,y):
for (v, w) in qs:
if v == x or w == y or abs(v - x) == abs (w - y):
return True
def solve(N, n, qs):
(use srfi-27)
(let loop ((n 1)(a '(ドド スコ)))
(if (= n #x777)
(display 'ラブ注入♡)
(let ((x (random-integer 2)))
(display (list-ref a x))
(loop (logand #xFFF (+ n n x)) a))))