Skip to content

Instantly share code, notes, and snippets.

View Khromium's full-sized avatar
🤔
🤔

Kei Khromium

🤔
🤔
View GitHub Profile
@Khromium
Khromium / get_temp.py
Created September 13, 2021 15:27
get temperature using DHT11
import time
from statistics import mean
from typing import List
import RPi.GPIO as GPIO
import dht11
from datetime import datetime
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
@Khromium
Khromium / img2pdf_recursively.py
Last active June 13, 2021 15:48
This script find images recursively and combining a pdf. Each pdf is named parent folder name.
"""
このスクリプトは指定したディレクトリから画像を再帰的に検索し、
親ファイルの名前でPDFを生成します。
This script find images recursively and combining a pdf.
Each pdf is named parent folder name.
"""
import logging
import mimetypes
import os
@Khromium
Khromium / compare_ssim.sh
Last active April 18, 2021 05:38
compare ssim
#! /usr/bin/bash
echo "extract images"
ffmpeg -ss $1 -i ./original.mp4 -vframes 1 -f image2 ./origin_$1_orig.png -loglevel quiet
convert -rotate 270 ./origin_$1_orig.png ./origin_$1.png
rm ./origin_$1_orig.png
ffmpeg -ss $1 -i ./mac.mp4 -vframes 1 -f image2 ./mac_$1.png -y -loglevel quiet
ffmpeg -ss $1 -i ./windows.mp4 -vframes 1 -f image2 ./windows_$1.png -y -loglevel quiet
echo "calc SSIM mac"
ffmpeg -loglevel info -i ./origin_$1.png -i ./mac_$1.png -filter_complex ssim -an -f null - 2>&1 | grep "SSIM R:"
echo "calc SSIM windows"
[Unit]
Description=AutoSSH tunnel service for sakura internet server
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 ubuntu@localtest.server -p 8080 -i /path/to/key -NfR 11022:localhost:22
[Install]
WantedBy=multi-user.target
@Khromium
Khromium / .histfile
Last active April 13, 2020 12:45
rtl8821ae が問題でCPUが暴走したときにやったこと
sudo cp /etc/default/grub /etc/default/grub.bak
sudo nnao /etc/default/grub
sudo nano /etc/default/grub
sudo update-grub
sudo update-grub
sudo pacman -S grub
sudo update-grub
/usr/sbin/update-gsudo grub-mkconfig -o /boot/grub/grub.cfg
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo pacman -S update-grub
@Khromium
Khromium / fx0reparted
Created March 2, 2020 14:09
fx0 partition memo
Number Start End Size File system Name Flags
1 8389kB 75.5MB 67.1MB fat16 modem
2 75.5MB 76.5MB 1049kB sbl1
3 76.5MB 77.1MB 524kB sdi
4 83.9MB 84.4MB 524kB DDR
5 92.3MB 94.4MB 2097kB aboot
6 94.4MB 95.4MB 1049kB rpm
7 95.4MB 96.5MB 1049kB tz
8 96.5MB 98.6MB 2097kB pad
@Khromium
Khromium / S400 Plus Automatic Settings.ini
Last active January 13, 2020 08:51
S400 Plus Scan settings using Naps2
REGEDIT4
[TWAIN Export]
TWAIN_EXPORT=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\PLUSTEK\7GAU\TWAIN\SETTINGS\S400 PLUS AUTOMATIC SETTINGS\SHEETFED FRONT\1]
"TOP"=dword:00000000
"HISTOGRAM-SHADOW-R"=dword:00000000
"DOCUMENT TYPE-COLOR"=dword:00000000
"HISTOGRAM-SHADOW-B"=dword:00000000
"GAMMA-R"=dword:00000064
"DOCUMENT TYPE-GRAY"=dword:00000003
@Khromium
Khromium / karabiner.json
Last active August 22, 2019 02:28
hhkbで使っているkarabinerの設定ファイル。実際に合わせていくつか設定を改変しています。
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@Khromium
Khromium / docker-compose.yml
Created March 29, 2019 13:13
knowledge with postgresql test
version: '2'
services:
https-portal:
image: steveltn/https-portal:latest
ports:
- '80:80'
- '443:443'
links:
- knowledge
restart: always
@Khromium
Khromium / Dockerfile
Created January 7, 2019 07:04
Environment of Natural Language Processing 〜サクッとNLPを始めたい人向け〜
FROM python:3.6
RUN apt-get update; apt-get -y upgrade; apt-get clean; rm -rf /var/lib/apt/lists/*
# PID-1対策とneologdでsudoを使うので追加
RUN apt-get update; apt-get -y install dumb-init sudo; apt-get clean; rm -rf /var/lib/apt/lists/*
RUN apt-get update; apt-get -y install wget swig unzip mecab libmecab-dev mecab-ipadic-utf8 git make xz-utils file curl; apt-get clean; rm -rf /var/lib/apt/lists/*
# neologd 辞書の導入
RUN wget https://codeload.github.com/neologd/mecab-ipadic-neologd/zip/v0.0.5 -O archive.zip ; unzip archive.zip; mv mecab-ipadic-neologd-0.0.5 mecab-ipadic-neologd
RUN mkdir -p /usr/lib/x86_64-linux-gnu/mecab/dic
RUN /mecab-ipadic-neologd/bin/install-mecab-ipadic-neologd -n -y
RUN rm -rf /mecab-ipadic-neologd