This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
import time | |
from threading import Thread | |
import RPi.GPIO as GPIO | |
import smbus | |
rev = GPIO.RPI_REVISION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.integrate import solve_ivp | |
def U(r): | |
return 0.5 * r ** 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2020 Patrick Fruh | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 2 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://staryoshi.hatenablog.com/entry/2015/10/27/173925 | |
#include <iostream> | |
#include <memory> | |
class Any { | |
private: | |
struct base { | |
virtual std::type_info const& type() const { return typeid(nullptr); } | |
virtual std::unique_ptr<base> clone() const { return nullptr; } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://maguro.dev/debug-macro/ | |
macro_rules! debug { | |
($($a:expr),* $(,)*) => { | |
#[cfg(debug_assertions)] | |
eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*); | |
}; | |
} | |
// https://kuretchi.hateblo.jp/entry/rust_nested_vec | |
macro_rules! nested_vec { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import itertools | |
from colorsys import hls_to_rgb | |
import numpy as np | |
from PIL import Image, ImageShow | |
INPUT = "1430311" | |
PIXEL = 70 # 1ピクセルのサイズ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import my_ext | |
a = np.arange(0, 8, dtype=np.uint8).reshape(4, 2) | |
my_ext.inspect(a) | |
print("--------\n") | |
my_ext.prepare() | |
b = my_ext.calc(a) |
OlderNewer