Skip to content

Instantly share code, notes, and snippets.

View xkikeg's full-sized avatar

kikeg xkikeg

  • Zürich, Switzerland
  • 23:39 (UTC +02:00)
View GitHub Profile
@xkikeg
xkikeg / LICENSE
Created January 9, 2023 07:21
LICENSE for all my gists (unless otherwise specified)
MIT License
Copyright (c) 2023 xkikeg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@xkikeg
xkikeg / revolut_to_ledger.js
Last active January 1, 2024 20:32
Extract Ledger-cli format string out of Revolut transactions page
// ==UserScript==
// @name Revolut.com to ledger
// @version 1.2
// @grant GM.setClipboard
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @match https://app.revolut.com/transactions*
// ==/UserScript==
@xkikeg
xkikeg / money_forward_to_ledger.js
Created September 24, 2021 15:45
Create ledger text out of Money forward (https://moneyforward.com/)
// ==UserScript==
// @name Moneyforward to ledger
// @version 1
// @grant GM.setClipboard
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @match https://moneyforward.com/accounts/show/*
// ==/UserScript==
function runReport(node) {
var result = [];
@xkikeg
xkikeg / wise_to_ledger.js
Last active September 21, 2021 09:26
Greasemonkey script to convert wise.com account to https://github.com/ledger/ledger/ format file.
// ==UserScript==
// @name Wise.com to ledger
// @version 1
// @grant GM.setClipboard
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @match https://wise.com/user/account/*
// ==/UserScript==
function getPayee(node) {
@xkikeg
xkikeg / file0.txt
Last active August 29, 2015 14:10
PureScript開発に至る前の環境整備 ref: http://qiita.com/liquid_amber/items/c9a439813cb0ca8649bc
$ # Ubuntu
$ # nodebrewで入れた see http://qiita.com/sinmetal/items/154e81823f386279b33c
$ # Mac
$ brew install node
@xkikeg
xkikeg / LICENSE
Last active December 22, 2016 10:39
Database.Esqueletoのサンプル
Copyright (c) 2014 liquid_amber
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@xkikeg
xkikeg / test.cc
Last active August 29, 2015 14:04
型の包含関係を調べるテンプレート
// for test
#include <memory>
#include <string>
#include <vector>
#include "type_inclusion.hh"
#define TO_STR(x) TO_STR_(x)
#define TO_STR_(x) #x
#define STATIC_ASSERT_SIMPLE(x) static_assert(x, TO_STR(x));
import System.IO (hFlush, stdout)
import Control.Concurrent (threadDelay)
main = do
putStr "\ESC[0G\ESC[0Ktest1 " >> hFlush stdout
threadDelay 1000000
putStr "\ESC[0G\ESC[0Ktest2 " >> hFlush stdout
threadDelay 1000000
putStr "\ESC[0G\ESC[0Ktest3 " >> hFlush stdout
putStrLn ""
@xkikeg
xkikeg / TAPL_03.md
Created December 18, 2013 08:17
型システム入門 第3章 型なし算術式

「型システム入門」メモ

第3章 型なし算術式

Syntax

BNFで定義したプログラムを自然演繹スタイルの推論規則として記述することができる。注意すべき点は実際には推論規則ではなく推論規則のスキーマ(C++的に言えばテンプレート)であるということ。実際にはメタ変数tには任意の項が入ってくる。 これらの構造に対する深さ、大きさなどを定義している。また、構造的な帰納法を定義している。

Semantics

上の項(プログラムと言ってもいい)がどのような意味を持つかを定義する。ここでは抽象機械を想定して意味を考えていく。 まず、項の意味というのは最終的にはである。とりあえずbooleanを考えるならtruefalseが値である。項を値になるまで簡約 (reduction)していくのが評価 (evaluation)ということになるが、この本ではreductionのステップを評価と読んでいる。本の流儀に合わせて評価と呼ぶことにしよう。 ここでも自然演繹スタイルの推論規則として評価関係を考えている。数学的に言う関係とは、例えば2項関係であれば特定のs∈S, t∈Tに対してR(s, t)が言える時のRであった。要は「ある項tを持ってきて評価すると項t'になるよ」ってことだ。

疑問点

{-# LANGUAGE OverloadedStrings #-}
import Control.Applicative
import Data.Binary.Get
import qualified Data.ByteString as BS
import Data.Conduit
import Data.Conduit.Serialization.Binary
import Data.Word
query :: BS.ByteString