Skip to content

Instantly share code, notes, and snippets.

@K4zuki
K4zuki / bcd-counter-7seg.gp6
Last active August 7, 2019 11:49
BCD-counter+7-seg-decoder+carry-out circuit using GreenPAK SLG46826G(TSSOP)
<?xml version="1.0" encoding="UTF-8"?>
<GPDProject version="9" oldestCompatibleVersion="9" GPDVersion="6.19.004" lastChange="2019/08/07 1:40">
<generalProjectSettings/>
<chip family="04" type="06" friendlyName="GreenPAK 6" partNumber="36" package="16">
<nvmData registerLenght="2048">12 90 39 EB B5 A6 9C 14 6D 8E BF 69 FE 96 F9 1B E6 AB 56 FA 47 1 60 55 D4 4 0 51 45 4D 56 45 59 15 65 55 94 55 51 56 45 5 1A 0 0 0 0 0 0 0 0 40 10 0 0 0 0 40 7 F9 A7 EF FA 8F DF FA AC 7F F9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 80 30 30 30 0 0 30 80 3 0 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14 22 30 C 0 0 0 0 0 0 0 15 71 0 0 40 0 0 10 0 15 D0 2B 78 6E 0 0 0 71 73 20 0 1 0 2 0 43 1F 0 1 2 0 1 0 10 2 1 0 80 2 0 1 0 9F 2 1 0 FB 2 0 1 0 45 2 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A5</nvmData>
<checksum crc32="0x1A16B46A" version="7"/>
<asmModel>
<stateMachine>
<asmMode
@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 ([email protected])
"""
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 May 22, 2024 08:54
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([email protected])
"""