Skip to content

Instantly share code, notes, and snippets.

View NotFounds's full-sized avatar
🦕

Iori IKEDA NotFounds

🦕
View GitHub Profile
@NotFounds
NotFounds / jpath.sh
Last active January 23, 2024 05:58
A script to interactively narrow down JSON Paths from a JSON file.
function jpath() {
local JSONFILE=$1
local _paths=$(jq -cr 'paths | map(if type=="number" then "[" + tostring + "]" else "." + tostring end) | join("")' $JSONFILE)
local _path=$(echo "$_paths" | fzf --preview "echo {} | xargs -I path jq 'path' $JSONFILE")
echo "$_path"
}
@NotFounds
NotFounds / for_team_members.md
Last active June 21, 2023 01:46
一緒のチームで仕事をする人に、自分(@NotFounds)がどんな人間か理解してもらうためのドキュメントです。

README for team members

この文章は、一緒のチームで仕事をする人に、自分(@NotFounds)がどんな人間か理解してもらうためのドキュメントです。

経歴

https://www.wantedly.com/id/iori_ikeda

性格・強み

StrengthFinder 2.0

image

@NotFounds
NotFounds / TextSegmenter.tsx
Last active September 27, 2022 02:32
A component to split a word by semantics for non-separated sentences like Japanese.
import React, { useMemo } from "react";
const joinWbr2StringArray = (ary: string[]) => {
const res: React.ReactNode[] = ary.filter((e) => !!e).flatMap((e, i) => [e, <wbr key={i} />]);
if (res.length > 0) res.pop();
return res;
};
type TextSegmenterCoreProps = {
children: string;
@NotFounds
NotFounds / _git_sync.sh
Last active June 30, 2022 04:04
Synchronize main/master branch with the remote
#!/bin/bash
set -euo pipefail
version="0.1.0"
usage() {
cat <<EOF
$(basename ${0}) - Synchronize main/master branch with the remote.
Usage:
@NotFounds
NotFounds / url_pattern_demo.ts
Last active September 16, 2021 04:03
URLPattern example in Deno
import { listenAndServe } from "https://deno.land/std@0.107.0/http/server.ts";
const addr = ":8080";
const patternsToHandlers = new Map([
[{ pathname: "/" }, rootHandler],
[{ pathname: "/ping" }, pingHandler],
[{ pathname: "/user/:id" }, userHandler],
]);
@NotFounds
NotFounds / fetchWithError.ts
Created May 18, 2021 18:40
fetch API wrapper to handle HTTP errors
const handleHttpErrors = (response: Response) => {
if (response.ok || response.redirected) {
return response;
}
// ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
switch (response.status) {
// Client error responses
case 400: throw Error('Bad Request');
case 401: throw Error('Unauthorized');
@NotFounds
NotFounds / fuzzySearch.ts
Created January 29, 2021 06:15
Simple fuzzy search in TS
function fuzzySearch(source: string, query: string, isIgnoreCase?: boolean): boolean {
if (source.length === 0 || query.length === 0) {
return false;
}
const _source = isIgnoreCase ? source.toLowerCase() : source;
const _query = isIgnoreCase ? query.toLowerCase() : query;
const queryIterator = function*() {
yield* [..._query];
@NotFounds
NotFounds / Dockerfile
Last active February 13, 2020 16:32
nvidia-docker
FROM nvidia/cuda:10.0-cudnn7-runtime
RUN apt-get update && apt-get install -y \
gcc \
make \
openssl \
libssl-dev \
libbz2-dev \
zlib1g-dev \
libreadline-dev \
"
set nocompatible
" move by cursor
set whichwrap=b,s,h,l,<,>,[,],~
" delete by backspace
set backspace=indent,eol,start
" file setting
@NotFounds
NotFounds / mnist-cnn.py
Last active September 24, 2018 14:20
chainer4.0.0 mnist sample
# コマンドライン引数を解析するライブラリを読み込む
import argparse
# pythonの数値計算用ライブラリを読み込む
import numpy as np
# chainerを読み込む
import chainer
import chainer.links as L
import chainer.functions as F