Skip to content

Instantly share code, notes, and snippets.

View wellflat's full-sized avatar
🐱
cat

ryohei tanaka wellflat

🐱
cat
View GitHub Profile
@wellflat
wellflat / read_smaps.py
Created August 21, 2016 07:22
read smaps file (Linuxプロセスのメモリ共有率を計算)
#!/usr/bin/env python
import sys
def read_smaps(pidlist):
try:
print("PID\tRSS\tSHARED\t\tNONE_SHARED")
mem = lambda t, f: int(f[1]) if f[0] == '%s:' % t else 0.0
for pid in pidlist:
filename = "/proc/%s/smaps" % pid
@wellflat
wellflat / emacs_memo.md
Last active May 28, 2018 02:57
Emacs Memo

色設定

色変更したい箇所にカーソルを合わせて以下のコマンドを実行してface名を確認

M-x describe-face

次に以下のコマンドを実行して、対象のface名を選択する

M-x list-faces-display
#include <iostream>
#include <faiss/IndexFlat.h>
#include <faiss/IndexIVFPQ.h>
#include <faiss/gpu/GpuIndexFlat.h>
#include <faiss/gpu/GpuIndexIVFPQ.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/index_io.h>
#include <faiss/utils.h>
#include <boost/program_options.hpp>
@wellflat
wellflat / image_loader.js
Created November 27, 2017 13:04
promise image loader
let loadImage = ({ src }) => {
return new Promise((resolve, reject) => {
let img = new Image();
img.onload = () => {
resolve(img);
};
img.src = src;
});
};
@wellflat
wellflat / pyvips.ipynb
Last active January 22, 2018 14:15
libvipsで高速省メモリな画像処理 part1 http://rest-term.com/archives/3434/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wellflat
wellflat / aws_s3_multipart_client.py
Last active August 12, 2020 06:50
AWS S3 multipart upload sample
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import botocore
from boto3.session import Session
from boto3.s3.transfer import TransferConfig
from pprint import pprint
class S3Client(object):
@wellflat
wellflat / HelloONNX.vue
Last active January 29, 2024 09:01
Image Classification using ONNX Runtime for Web (ORT Web)
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<canvas width="32" height="32" ref="canvas"></canvas>
<button type="button" @click="inference">inference</button>
<span>{{ infoLabel }}</span>
</div>
</template>
<script lang="ts">
@wellflat
wellflat / random_sample.py
Created September 5, 2022 01:37
Random sampling image files for torchvision.datasets.ImageFolder
#!/usr/bin/env python
import glob
import random
import shutil
import math
def random_sample_file(input_dir: str, output_dir: str, sample_ratio: float=0.05):
print(f'copy {input_dir} to {output_dir}')