Skip to content

Instantly share code, notes, and snippets.

View orisano's full-sized avatar

Nao Yonashiro orisano

View GitHub Profile
#!/usr/bin/env python3
import json
import os
import os.path
import sys
import urllib.request
def grep(f, text):
for line in f:
t = line.decode()
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"required": [
"version"
],
"properties": {
"version": {
"const": "2"
},
@orisano
orisano / sqlite-wams.d.ts
Created June 5, 2023 01:35
sqlite-wams.d.ts
declare module "@sqlite.org/sqlite-wasm" {
type ColumnName = string;
type ColumnIndex = number;
type BlobType = Uint8Array | Int8Array | ArrayBuffer;
type BindableType = undefined | null | number | string | boolean | bigint | BlobType;
type ResultCode = number;
type SQLiteDataType = 1 /* SQLITE_INTEGER */
| 2 /* SQLITE_FLOAT */

Keybase proof

I hereby claim:

  • I am orisano on github.
  • I am orisano (https://keybase.io/orisano) on keybase.
  • I have a public key ASDTRHsoPPZl9f-U-6LZBwm573s2zPC0rB66H6p2mprcxQo

To claim this, I am signing this object:

CREATE TABLE artifacts(idx INTEGER PRIMARY KEY, group_id TEXT, artifact_id TEXT);
CREATE TABLE indices2(artifact_idx INTEGER, version TEXT, sha1 BLOB, archive_type TEXT);
INSERT INTO artifacts(group_id, artifact_id) SELECT group_id, artifact_id FROM indices GROUP BY group_id, artifact_id;
INSERT INTO indices2(artifact_idx, version, sha1, archive_type) SELECT a.idx, i.version, i.sha1, i.archive_type FROM indices i JOIN artifacts a ON i.group_id = a.group_id AND i.artifact_id = a.artifact_id;;
CREATE INDEX artifacts_idx ON artifacts(group_id, artifact_id);
CREATE INDEX indices2_sha1_idx ON indices2(sha1);
CREATE INDEX indices2_artifact_idx ON indices2(artifact_idx);
@orisano
orisano / quic.rb
Last active August 17, 2021 12:56
unasuke quic
# This software is released under the MIT License.
# Copyright 2021 Yusuke Nakamura
# Copyright 2021 Nao Yonashiro
# https://opensource.org/licenses/MIT
require "bundler/inline"
require "socket"
gemfile do
source "https://rubygems.org"
@orisano
orisano / .tmux.conf
Created October 1, 2020 10:52
マウスで操作するtmux
set -g default-terminal "screen-256color"
set -g mouse on
setw -g alternate-screen on
set -g status-left "[+] "
bind -n MouseDown1StatusLeft new-window
import json
import sys
head = sys.stdin.readline().strip()
cols = [x for x in head.split(" ") if x]
col_end = {col: head.find(col)+len(col) for col in cols}
def get_col(line, c):
if c == cols[0]:
if line[0] == " ":
import argparse
import itertools as it
def pipe(x, fn):
for f in fn:
x = f(x)
return x
#include <algorithm>
#include <vector>
template <typename T>
struct RMQ {
using Index = int;
using BitIndex = int;
const std::vector<T>& A;
const int N, S, L;