Skip to content

Instantly share code, notes, and snippets.

View estshorter's full-sized avatar

estshorter estshorter

View GitHub Profile
@estshorter
estshorter / argononed.py
Last active November 12, 2020 13:25
argononed.py
#!/usr/bin/python3
import os
import time
from threading import Thread
import RPi.GPIO as GPIO
import smbus
rev = GPIO.RPI_REVISION
@estshorter
estshorter / update-mb.rs
Last active January 28, 2020 12:04
Rust script for downloading and applying MusicBee Patches from https://getmusicbee.com/patches/
use std::fs::{self, File};
use std::io::{self, stdout, BufWriter, ErrorKind, Write};
use std::path::PathBuf;
use std::process::Command;
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
use std::time::SystemTime;
use chrono::{DateTime, Local, TimeZone, Utc};
@estshorter
estshorter / TqdmLoggingHandler.py
Last active December 31, 2019 05:13
TqdmLoggingHandler
import logging
import tqdm
class TqdmLoggingHandler(logging.Handler):
# https://stackoverflow.com/questions/38543506/change-logging-print-function-to-tqdm-write-so-logging-doesnt-interfere-wit
def __init__(self, level=logging.NOTSET):
super().__init__(level)
def emit(self, record):
@estshorter
estshorter / test-logging.py
Last active January 3, 2020 11:39
script for logging
import contextlib
import datetime
import time
import logging
from logging.handlers import MemoryHandler
import sys
from typing import Any, Callable, Iterator, MutableMapping
from tqdm import tqdm
import toml
@estshorter
estshorter / toml-test.py
Created December 31, 2019 05:05
script for testing toml
import toml
import logging
# なんとなくloggingで出力する
logging.basicConfig(level=logging.DEBUG, format="{message}", style="{")
# 文字列としてパスを与えると読み込める
# pathlib.Pathクラスでも可
params = toml.load("./parameter/nominal.toml")
# dictクラスとしてロードされる
@estshorter
estshorter / keybindings.json
Last active December 31, 2019 00:44
keybindings.json for VS Code
// 既定値を上書きするには、このファイル内にキー バインドを挿入しますauto[]
[
{
"key": "ctrl+f9",
"command": "python.execInTerminal",
"when": "editorLangId == 'python'"
},
{
"key": "ctrl+;",
"command": "workbench.action.terminal.focus",
@estshorter
estshorter / settings.json
Last active January 5, 2020 06:23
settings.json for VS Code
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Args": [
"--max-line-length",
"88",
"--ignore=E203,W503,W504"
],
"python.formatting.provider": "black",
@estshorter
estshorter / update-musicbee.py
Last active January 5, 2020 06:19
Python script for downloading and applying MusicBee Patches from https://getmusicbee.com/patches/
from datetime import datetime, timezone
import os
from pathlib import Path
import subprocess
from urllib import request
from zipfile import ZipFile
from bs4 import BeautifulSoup
import pytz
@estshorter
estshorter / install-openssl.sh
Last active January 17, 2025 10:28
Install openssl on raspberry pi
#!/bin/bash -eu
OPENSSL_VER=1.1.0g
mkdir openssl
cd openssl
wget https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz
tar xf openssl-${OPENSSL_VER}.tar.gz
cd openssl-${OPENSSL_VER}
./config zlib shared no-ssl3
@estshorter
estshorter / download.sh
Last active February 4, 2018 03:04
Raspbianを音楽サーバ化するビルドレシピ ref: https://qiita.com/estshorter/items/8ca0327f6d7e6ea9cd01
mkdir ~/setup
cd ~/setup
wget https://raw.githubusercontent.com/estshorter/raspi-autosetup/master/setup.sh -O ./setup.sh
chmod u+x ./setup.sh