Skip to content

Instantly share code, notes, and snippets.

@hanya
hanya / README.md
Last active December 15, 2015 16:38
Macro executor dialog for KiCAD Pcbnew

Macro executor for KiCAD Pcbnew

This macro provides the dialog which allows you to execute your Python macros easily.

How to use

Put the macros.py file in the plugin directory let the file is automatically loaded.

KICAD_PATH/scripting/plugins
@hanya
hanya / README.md
Last active October 6, 2016 13:16
KICAD macro - set text properties on PCBnew

KICAD macro to set text properties on PCBnew

This macro provides way to set text properties on your PCBnew board. You can choose targets by regular expression of the module reference or text string.

Here is the function definition.

def set_text_properties(board, pattern, type="reference", width=None, height=None, thickness=None, visibility=None):
    """ Sets text properties which matches with the pattern. 
 @param board Pcbnew board
@hanya
hanya / README.md
Last active December 29, 2016 16:12
KiCAD macro to add macros executor window to PyShell of Pcbnew

KiCAD macro to add macros executor window to PyShell of Pcbnew

This macro works on Python Shell provided by KiCAD 4.1 or later. 4.0.X can not be supported.

Python Shell is pretty good to execute your line of code provided by Pcbnew. But it is hard to execute long macro many times in the interactive mode. This macro provides way to execute your macros from files stored on your specified directory.

Prepare macros in selected directory and specify it in _KIMACROS variable on Preferences - Configure Paths dialog. Copy content of pyshell_hack.py file into your PyShell_pcbnew_startup.py file which can be found through

@hanya
hanya / README.md
Last active March 19, 2017 16:25
Converts outline file between hierarchical text and OPML

Outline conversion script

Converts outline file between hierarchical text and OPML. This python script works with only Python3.

Here is list of options can be specified.

python3 olconv.py -h
usage: olconv [-h] [--version] [--char CHAR] [-f F] [-o O] [-i {hier,opml}]
 [-x {hier,opml}] [--title TITLE] [--text TEXT]
@hanya
hanya / logger.cc
Created May 20, 2017 15:48
logger application to take some message and write into standard output on Haiku OS
// Compile as follows:
// g++ logger.cc -lbe -o logger
#include <Application.h>
#include <iostream>
#include <string.h>
#define LOGGER "application/x-vnd.Logger"
enum {
@hanya
hanya / copy_catkeys.py
Created June 13, 2017 14:54
Copies translated entries and merge with new en.catkeys for Haiku catkeys
 import argparse
class Catkeys:
def __init__(self, path):
self.path = path
with open(path, "r") as f:
lines = f.readlines()
if not lines:
raise Exception('no data: ' + path)
data = {}
@hanya
hanya / README.md
Last active September 18, 2017 13:21
Customize text size and line width of KiCAD modules

Customize text size and line width of KiCAD modules

If you think official footprint modules have small text size or thin lines for drawings, you can change them with this script at once.

You need https://github.com/adamgreig/agg-kicad/blob/master/scripts/sexp.py file to execute this script. Obtain it and put it into the same directory with the customize_mods.py file.

Here is list of options can be specified.

@hanya
hanya / HHKB
Created February 3, 2019 13:53
HHKB layout for Haiku OS
name = HHKB
# Place in /boot/home/config/non-packaged/data/KeyboardLayouts
# Size shortcuts
default-size = 10,10
$b = 5,10
$c = 18,10
$d = 15,10
$enter = d22,10
@hanya
hanya / HHKB_JP
Created February 3, 2019 13:54
HHKB_JP layout for Haiku OS
name = HHKB JP
# Place in /boot/home/config/non-packaged/data/KeyboardLayouts
# Size shortcuts
default-size = 10,10
$b = 5,10
$c = 20,10
$d = 15,10
$e = l15,20,11
@hanya
hanya / JP_108-key
Created February 3, 2019 13:55
Japanese 108 keys layout for Haiku OS
name = JP 108
# Place in /boot/home/config/non-packaged/data/KeyboardLayouts
# Size shortcuts
default-size = 10,10
$b = 5,10
$c = 20,10
$d = 15,10
$e = l15,20,11