Skip to content

Instantly share code, notes, and snippets.

View kosugi's full-sized avatar

KOSUGI Tomo kosugi

  • tokyo.japan
View GitHub Profile
; https://qiita.com/mattn/items/ae764601862b0073071e
(use gauche.sequence)(fold-with-index(lambda(n a c)(string-append c a(if(< 1 n)"ー" "")))""(shuffle '("ボ" "ジョ" "レ" "ヌ" "ボ")))
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))))))
*[aria-label="Footer"] {
display: none;
}
header[role="banner"] {
display: none;
}
*[data-testid="sidebarColumn"] {
display: none;
}
body, *[data-testid="primaryColumn"] {
@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",
#! /bin/bash
echo '吉高由里子かわいい'
@kosugi
kosugi / Makefile
Last active May 31, 2017 05:52
make yocifico great again
.PHONY: yocifico great again
yocifico:
@echo 人生
great:
@echo どうでも
again:
@echo 飯田橋
@kosugi
kosugi / intel_mm_mover.js
Created September 27, 2016 07:50
bookmarklet for moving between Ingress Mission Map and Ingress Intel Map alternately
// original source
(function(host, x) {
if (host === 'ingressmm.com') {
x = Map.getCenter();
location.href = ['https://www.ingress.com/intel?ll=', x.lat(), ',', x.lng(), '&z=', Map.getZoom()].join('');
}
else if (host === 'www.ingress.com') {
x = document.cookie.split(';').reduce(function(ps, c) {
if (c.match(/\s*\bingress.intelmap.(\w+)=([-\+\d\.]+)\b\s*/)) {
ps[RegExp.$1] = RegExp.$2;
@kosugi
kosugi / zundoko.hs
Last active April 3, 2016 07:52
https://twitter.com/kosugi/status/710762099954221056 の清書 (+ 配列で返すようにした版)
import Data.Bits
import System.Random
zundoko :: Int -> (Int, String)
zundoko n = (n, ["ズン", "ドコ"] !! n)
zundokos :: StdGen -> [(Int, String)]
zundokos gen0 = let (n, gen1) = randomR (0, 1) gen0 in
(zundoko n) : (zundokos gen1)
http://qntm.org/files/hatetris/hatetris.html#梜𤆻𔖼𤆻𤇁𢊻𤅛𥆸𠞻𤂻栌𤂻𤇅䂺𤅋𠆗𢚻𤆀䂺ꉷ𣮻𤆻𡮻𣦻𤆻𤶻𤅻𔗇𢊻𤅵𤇅𤃅郇込𤄛𤚑兌𣠋𡚻𠇇𥆰𤦐𣸫倌𤆰𣻅𔔌𤞰𤞻䂸𣉋䂸䨋𢛄
@kosugi
kosugi / reflection.scala
Last active January 3, 2016 12:24
“dir” command in REPL in scala.
def typeOf(obj: Any) = scala.reflect.runtime.currentMirror.reflect(obj).symbol.typeSignature
def _format(xs :Iterable[Any]) = xs.map(_.toString).toList.distinct.sorted.foreach(println)
def members(obj: Any) = _format(typeOf(obj).declarations)
def classes(obj: Any) = _format(typeOf(obj).baseClasses)