Skip to content

Instantly share code, notes, and snippets.

diff --git a/disk/iostat_darwin.c b/disk/iostat_darwin.c
index 9619c6f..04d9984 100644
--- a/disk/iostat_darwin.c
+++ b/disk/iostat_darwin.c
@@ -25,7 +25,7 @@ readdrivestat(DriveStats a[], int n)
kern_return_t status;
int na, rv;
- IOMasterPort(bootstrap_port, &port);
+ IOMainPort(bootstrap_port, &port);
#!/usr/bin/env python3
import sys
import os
import json
result = {"themes": []}
skip_themes = [
"autorch-sphinx-theme", # no theme named 'pytorch_sphinx_theme' found (missing theme.conf?)
@shirou
shirou / main.py
Last active November 10, 2020 06:16
Write file with timebased rotate and compression.
import file_logging
import time
file_logger = file_logging.setup("/tmp/foo/bar/example.log")
for i in range(0, 1000):
file_logger.info(f"msg: {i}")
time.sleep(0.3)
use std::io::{self};
fn main() -> io::Result<()> {
println!("<!--");
let mut paragraph: [String; 30] = Default::default();
let mut count = 0;
loop {
let mut buffer = String::new();
match io::stdin().read_line(&mut buffer) {
@shirou
shirou / open_in_tmux.sh
Created June 4, 2020 00:13
Open file from other window
alias coder="VSCODE_IPC_HOOK_CLI=`ls --sort=time /tmp/vscode-ipc-* | head -n 1` `ls ~/.vscode-server/bin/*/bin/code | head -1`"
@shirou
shirou / dictionary.md
Last active June 3, 2020 13:06
opentelemtry翻訳一時的置き場

辞書

  • document
    • 文章
  • context
    • コンテキスト
  • context propagation
    • コンテキスト伝搬
  • Metrics
  • メトリック
@shirou
shirou / display.sh
Created April 25, 2020 12:41
how to enable high resolution display with Ubuntu 20.04 on VirtualBox
# change your display setting in VirtualBox to VBoxVGA
# execute 'cvt 2560 1360' to get the newmode line
xrandr --newmode "2560x1360_60.00" 293.50 2560 2744 3016 3472 1360 1363 1373 1410 -hsync +vsync
xrandr --addmode VGA-1 "2560x1360_60.00"
xrandr --output VGA-1 --mode 2560x1360_60.00
# 2560x1400 is not working for me with below error and I don't know why
#
import sys
import cv2
def sliding_window(image, stepSize, windowSize):
for y in range(0, image.shape[0], stepSize):
for x in range(0, image.shape[1], stepSize):
# yield the current window
yield (x, y, image[y : y + windowSize[1], x : x + windowSize[0]])
#!/usr/bin/env python3
import sys
import os
import unicodedata
from tempfile import NamedTemporaryFile
def is_nfd(line):
for char in line.strip():