Skip to content

Instantly share code, notes, and snippets.

@K4zuki
K4zuki / use-lupa.md
Created July 10, 2019 05:12
use-lupa.md

get lupa package

apk add py3-lupa
apt install python3-lupa

use lupa to get lua module search paths

@K4zuki
K4zuki / docx_colspan.py
Last active April 30, 2019 13:57
Table column spanning post processor for a docx file
import docx
"""
Col span
+----+----+----+----+
|hoge|piyo|foo |bar |
+----+----+----+----+
|baz | |foo |bar |
+----+----+----+----+
@K4zuki
K4zuki / docx_property.py
Created November 14, 2018 09:40
docx_property.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Do nothing but get properties from a docx
requires python-docx >= 0.8.6
MIT licence (c) Kazuki Yamamoto (k.yamamoto.08136891@gmail.com)
"""
import docx
doc = docx.Document(outfile)
@K4zuki
K4zuki / listing_test.py
Last active November 6, 2018 05:35
change attributes of code block inside `pandoc-crossref` listing div
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
python3.5 works as-is
json lib does not work as expected with python2.7
seems utf-8 string related
pandoc -t docx -o <docx filename> <input filename>
--filter=pandoc-crossref --filter=./listing_test.py
"""
@K4zuki
K4zuki / memo_to_create_eagle_project.md
Created April 7, 2018 20:43
memo to create an eagle project

directory structure

  • <project_name>
    • myPCBlib/ submodule to specific version of myPCBlib
    • update_link/ submodule to update symlink to local lib directory
      • git submodule add https://gist.github.com/8dcf8faa12d411bc8090d22c11dbfc8c.git update_link
    • eagle.epf
    • <project>.sch schematic file
    • <project>.brd board layout file
  • / cam output directory
@K4zuki
K4zuki / update_link.sh
Last active April 8, 2018 14:08
update existing link to current directory
@K4zuki
K4zuki / INSTALL.md
Last active June 26, 2021 22:57
Alpine linux pandoc setup

Should work on Linux/Mac host!

  • use docker
  • add env lines in .bashrc
    export DOCKER_TLS_VERIFY="1"
    export DOCKER_HOST="tcp://192.168.99.100:2376"
    export DOCKER_CERT_PATH="$HOME\.docker\machine\machines\default"
    export DOCKER_MACHINE_NAME="default"
  • $ docker run alpine:edge /bin/sh
@K4zuki
K4zuki / change_table_style.py
Last active October 23, 2017 05:53
python-docx to change table style
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
opens a docx file, replace ALL table style(*) and save on same file
mainly for pandoc exported docx file
(*) the applying style must be pre-defined in given file
Applies MIT License - 2017 K4ZUKI(K4zuki@github.com)
"""
@K4zuki
K4zuki / YetAnotherRelayBoard.md
Last active September 21, 2017 18:04
yet another relay board

idea

  • isolate leaky instruments by relay and external control

  • 4mm Banana plug/juck, distance 19.05mm

  • 2 x 1c or 1 x 2c terminal relay 5~10ADC rating

  • 50x50mm PCB, 35x35xM3 hole, 4x4R corner

  • Akizuki plastic panel