Skip to content

Instantly share code, notes, and snippets.

View kosugi's full-sized avatar

KOSUGI Tomo kosugi

  • tokyo.japan
View GitHub Profile
@kosugi
kosugi / svgcube.py
Created October 12, 2023 09:15
Last Layer の盤面を SVG で生成する. SVG の内容は Cube Voyage <https://cubevoyage.net/> から拝借しているので微妙.
# -*- coding: utf-8 -*-
import sys
usage = f'''
usage: {sys.argv[0]} ABC DEF GHI JKL MNO PQR STU
RQP
+---+
S|ABC|O
// 現在の表示範囲内ポータル群を名前で検索する (部分一致)
javascript:(function(){const q=prompt("portal query:");if(typeof q==="string"){for(const guid in portals){const data=portals[guid].options.data;if(typeof data.title==="string"&&0<=data.title.indexOf(q)){const ll=new String(data.latE6/1000000)+","+new String(data.lngE6/1000000);const url=new URL("https://intel.ingress.com/intel");url.searchParams.set("ll",ll);url.searchParams.set("pll",ll);url.searchParams.set("z","18");console.log(url.toString(),guid,data.title);}}}})();

Keybase proof

I hereby claim:

  • I am kosugi on github.
  • I am kosugi (https://keybase.io/kosugi) on keybase.
  • I have a public key whose fingerprint is 2825 505B 9D7D 16B5 2BAE 9D1E FA83 9F37 0983 EEC3

To claim this, I am signing this object:

@kosugi
kosugi / nomoretweets.js
Last active June 4, 2023 06:45
No more tweets
// ==UserScript==
// @name No More Tweets
// @namespace https://twitter.com/kosugi
// @version 0.1
// @description NO MORE TWEETS
// @match https://twitter.com/*
// @grant none
// ==/UserScript==
const moreTweetsContents = ({en: ['More Tweets', 'Discover more'], ja: ['その他のツイート', 'もっと見つける']})[document.querySelector('html').lang];
(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))))
# -*- 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):
@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*
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
;;
;; macOS の「次のウィンドウを操作対象にする」を実現するための AutoHotkey Script
;;
;; active window が属する process の window 群の中で,
;; active window の window handle が次に大きい (かつ UI を持つ) window を focus する.
;;
;; is_asc が false の場合は「次に小さい」 window を対象とする.
;;
;; TODO: 「UI を持つ」判定に window style を用いているが確証が無い
;;
; https://qiita.com/mattn/items/ae764601862b0073071e
(use gauche.sequence)(fold-with-index(lambda(n a c)(string-append c a(if(< 1 n)"ー" "")))""(shuffle '("ボ" "ジョ" "レ" "ヌ" "ボ")))