Skip to content

Instantly share code, notes, and snippets.

View generate_new_sphinx_theme_json.py
#!/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 Nov 10, 2020
Write file with timebased rotate and compression.
View main.py
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)
View doc-ja-comment-out.rs
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 Jun 4, 2020
Open file from other window
View open_in_tmux.sh
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 Jun 3, 2020
opentelemtry翻訳一時的置き場
View dictionary.md

辞書

  • document
    • 文章
  • context
    • コンテキスト
  • context propagation
    • コンテキスト伝搬
  • Metrics
    • メトリック
@shirou
shirou / display.sh
Created Apr 25, 2020
how to enable high resolution display with Ubuntu 20.04 on VirtualBox
View display.sh
# 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
#
View opencv4-qr-detect-sliding-window.py
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]])
View nfc_converter.py
#!/usr/bin/env python3
import sys
import os
import unicodedata
from tempfile import NamedTemporaryFile
def is_nfd(line):
for char in line.strip():
@shirou
shirou / dummy.go
Last active Oct 19, 2019
marketstore dummy plugin
View dummy.go
package main
import (
"context"
"math/rand"
"time"
)
// DummySubscriber is an dummy
type DummySubscriber struct {
@shirou
shirou / race_pipe.go
Last active Apr 21, 2019
go version go1.11.1 linux/amd64 build with `go build -race`
View race_pipe.go
package main
import (
"bytes"
"context"
"fmt"
"os/exec"
)
// copied from internal/common/common.go