Skip to content

Instantly share code, notes, and snippets.

View serihiro's full-sized avatar

Kazuhiro Serizawa serihiro

View GitHub Profile
@serihiro
serihiro / main.java
Last active January 21, 2024 07:12
Lucene in 5 minutes (https://lucenetutorial.com/lucene-in-5-minutes.html) with lucene 9.9.1
package org.example;
import java.io.IOException;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
@serihiro
serihiro / app.py
Last active October 11, 2023 14:33
Elasticsearch search viewer with Streamlit example
import streamlit as st
from elasticsearch import Elasticsearch
def main():
st.title("Streamlit ES Viewer")
with st.form("my_form", clear_on_submit=False):
keyword = st.text_input("keyword", "Python")
title_weight = st.number_input(
label="title weight", value=1.0, min_value=0.0, max_value=5.0, step=0.1
@serihiro
serihiro / Emoloyee.java
Last active January 1, 2022 12:48
Hot to smart-cast a Java class variable in Kotlin
import javax.annotation.Nullable;
public class Employee {
private String firstName;
private String lastName;
private Integer age;
public Employee(String firstName, String lastName, Integer age){
this.firstName = firstName;
this.lastName = lastName;
@serihiro
serihiro / graph.rmd
Last active January 3, 2020 06:07
1から10^6の範囲の整数に含まれる素数を昇順で並べた時の差分を表示するスクリプト
---
title: "distance_graph"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
```
@serihiro
serihiro / practice_record.md
Created January 2, 2020 01:53
AtCoder過去問練習用テンプレ

結果

解答

A

B

C

@serihiro
serihiro / contest_record.md
Last active May 4, 2020 01:03
AtCoder参戦記録用テンプレ

[:contents]

結果

問題 ACまでに要した時間 AC WA TLE
A : 0 0 0
B : 0 0 0
@serihiro
serihiro / main.cpp
Last active February 8, 2020 09:49
My Cpp template for competitive programing.
#include <bits/stdc++.h>
#define REP(i, x) REPI(i, 0, x)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
int main() {
@serihiro
serihiro / examine_imagenet_data_size_and_count.sh
Last active September 9, 2023 06:06
A shell script to count the total size and counts of ImageNet training dataset. For busy people; 1,281,167 images / 146,999,143,316 Byte
#!/bin/bash
BASE_DIR="/path/to/imagenet/train"
ALL_DIRS=`ls $BASE_DIR | grep -v .tar | grep -v .sh`
total_size=0
total_count=0
for dir in $ALL_DIRS
do
target_dir="${BASE_DIR}/${dir}"
@serihiro
serihiro / simple_inferer.py
Created September 22, 2019 09:59
simple onnx runtime (support only MNUIST / GEMM + RELU )
import argparse
import onnx
import numpy as np
from onnx import numpy_helper
from PIL import Image
def relu(x: np.ndarray) -> np.ndarray:
return np.maximum(x, 0)
@serihiro
serihiro / node.md
Last active September 13, 2019 13:57
blueoil dlk sample note

I have tried the quickstart of https://github.com/blue-oil/blueoil/tree/master/dlk .

venv ❯ PYTHONPATH=python/dlk python python/dlk/scripts/generate_project.py --help

Options:
  -i, --input_path PATH           protobuf path which you want to convert to C
                                  codes
  -o, --output_path TEXT          output path which you want to export any
                                  generated files