Skip to content

Instantly share code, notes, and snippets.

View callmekohei's full-sized avatar

callmekohei callmekohei

  • Fukuoka / Japan
View GitHub Profile
@ninjarobot
ninjarobot / JsonConfigSource.fs
Created January 20, 2021 23:52
Load a configuration source from a JSON string in F#
open Microsoft.Extensions.Configuration
/// Builds a configuration source from raw JSON.
let configSourceFromJson (json:string) : IConfigurationSource =
{ new IConfigurationSource with
member this.Build (builder:IConfigurationBuilder) =
{ new ConfigurationProvider() with
member this.Load() =
this.Data <- Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string,string>> json
} :> IConfigurationProvider
@rf0444
rf0444 / HelloExcelSplit.fs
Last active August 18, 2019 09:22
エクセルのシートに記入されたリストを分割するのを ExcelDNA & F# でやってみるやつ
module HelloExcelSplit
open ExcelDna.Integration
let splitIndex (group: int) (total: int): seq<seq<int>> =
let d = total / group
let m = total % group
let counts = seq { for i in 0 .. group - 1 do yield d + if i < m then 1 else 0 }
let (_, xs) = Seq.fold (fun (a, xs) x -> (a + x, Seq.append xs (Seq.singleton (seq { a .. a + x - 1 })))) (0, Seq.empty) counts
xs
@ytez
ytez / linebreak_in_fields.awk
Last active October 15, 2022 02:41
AWK: フィールド内に改行(LF)を含むCSVをパースしてみる (for @callmekohei)
#!/usr/bin/gawk -f
BEGIN{
RS="\r\n"
FPAT="[^,]+|\"[^\"]+\""
OFS= " --> "
}
{
gsub(/\n/, "<LF>", $0);
print $1, $2, $3

テキストプロパティ触ってみた

2019-03-11 gorilla.vim #2

@romainl
romainl / colorscheme-override.md
Last active April 6, 2024 22:42
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.
@pudquick
pudquick / input_sources.py
Last active October 16, 2022 08:35
Using python and pyobjc to enumerate and inspect input sources (keyboard layouts, input modes) on macOS
# Useful for com.apple.HIToolbox.plist for configuration of input types, amongst other things
from Foundation import NSBundle
import objc
HIToolbox_bundle = NSBundle.bundleWithIdentifier_("com.apple.HIToolbox")
HIT_functions = [
('TISCreateInputSourceList','@@B'),
('TISGetInputSourceProperty', '@@@'),

μ'sとAqoursの誕生日についての考察(?)

この記事は ラブライブ! Advent Calendar 2016 の8日目の記事です。

7日目の記事はnanikanaさんの ある野外フェスでその曲を聴くということについて - ただ春を待つ でした。3rdライブでの僕今大合唱は今でも鮮明に覚えています。私も号泣しながら歌っていました。僕光も1日目のライブビューイングでは歌うどころではなかったしその気もなかったですが、2日目現地では2番から歌っていました。いつかまたμ'sが歌う僕光を生で聴けることを願っています。

この記事の趣旨

タイトルに反して別に深い考察とかはないです。いわゆる「誕生日問題」をμ'sとAqoursに当てはめて遊んでみました。

//================================================================================
// 共通
//================================================================================
type EmailAddress =
{ EAValue: string }
type SurfaceAddress =
{ SAValue: string }
type Customer =
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
一定要用系统自带的 python, 用 brew 或其他方式安装的 python 不能识别 AppKit 等模块,花了很长时间在 pyobjc 的文档中看到这样一句话:
The system version of Python (``/usr/bin/python``) includes a copy of
PyObjC starting at MacOSX 10.5 ("Leopard"). Installing other versions
@kyuden
kyuden / install_jman.sh
Created June 11, 2016 17:38 — forked from ay65535/install_jman.sh
日本語manページをインストールするスクリプト (Mac用,というか自分用)
#!/usr/bin/env bash
# 参考サイト: http://tukaikta.blog135.fc2.com/blog-entry-224.html
# ================各種設定================
# ダウンロードするファイル (GNU 日本語man)
#
# http://linuxjm.sourceforge.jp/ からダウンロードするファイルを指定します。
#export GNUJMAN=man-pages-ja-20120915.tar.gz
#export GNUJMAN=man-pages-ja-20150315.tar.gz