Skip to content

Instantly share code, notes, and snippets.

View sethfischer's full-sized avatar

Seth Fischer sethfischer

View GitHub Profile
@sethfischer
sethfischer / rules.txt
Created April 2, 2024 07:05 — forked from darkxst/rules.txt
KiCad DRC rules for JLCPCB, 2 & 4-layer PCB
(version 1)
#Kicad 7
# 2-layer, 1oz copper
(rule "Minimum Trace Width (outer layer)"
(constraint track_width (min 5mil))
(layer outer)
(condition "A.Type == 'track'"))
(rule "Minimum Trace Spacing (outer layer)"
#!/bin/sh
git init
cat << EOF | tee .gitignore
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
# Format documentation: http://kicad-pcb.org/help/file-formats/
# Temporary files
*.000
@sethfischer
sethfischer / cadquery-multilayer-dxf-proposal.py
Last active February 11, 2023 09:25
Demo of proposed multilayer DXF utility class for CadQuery. See https://github.com/CadQuery/cadquery
"""Multilayer DXF demo.
Demo of proposed multilayer DXF utility class for `CadQuery <https://github.com/CadQuery/cadquery>`_.
See ` DXF multilayer support #1267 <https://github.com/CadQuery/cadquery/pull/1267>`_.
"""
import cadquery as cq
from osr_common.cq_dxf import DxfDocument
@sethfischer
sethfischer / get-current-git-tag.sh
Created September 18, 2022 00:50 — forked from mjj2000/get-current-git-tag.sh
[GIT] Get tag of current branch(that is HEAD) or fallback to short commit hash(7 digits) by single shell command
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD
@sethfischer
sethfischer / aec_2020_vslot.py
Created August 24, 2022 09:08
AEC 2020 V-slot Aluminium Extrusion profile
from math import radians, sqrt, tan
from typing import Tuple
import cadquery as cq
def reflect_xy(point: Tuple[float, float]) -> Tuple[float, float]:
"""Reflect point in axis x=y.
Reflect by reversing tuple.
@sethfischer
sethfischer / aec_2020_vslot.dxf
Created May 10, 2022 08:29
Aluminium Extrusion Company 2020 V-slot Aluminum Extrusion AEC 2020
999
{"supplier": "Aluminium Extrusion Company", "url": "https://alexco.co.nz", "part": "AEC 2020", ""description": "2020 V-slot Aluminum Extrusion"}
0
SECTION
2
HEADER
9
$ACADVER
1
AC1021
@sethfischer
sethfischer / jq-cheetsheet.md
Created October 27, 2021 07:28 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@sethfischer
sethfischer / pretty-print-json-in-terminal.sh
Last active January 19, 2021 01:09
Pretty print JSON in terminal
curl --silent --show-error https://api.github.com/users/sethfischer | python -m json.tool | pygmentize -l javascript
@sethfischer
sethfischer / restore-db-progress.sh
Created December 17, 2020 21:27
Restore MySQL database into a Docker container showing progress
# Database dump is compressed with this command
# xz --keep --compress mysql-dump.sql
# Drop and create database
docker exec -e "MYSQL_PWD=password" -i project_mysql_1 mysql -uroot <<< "DROP DATABASE database_name;"
docker exec -e "MYSQL_PWD=password" -i project_mysql_1 mysql -uroot <<< "CREATE DATABASE database_name;"
docker exec -e "MYSQL_PWD=password" -i project_mysql_1 mysql -uroot <<< "SHOW DATABASES;"
# Restore database
pv mysql-dump.sql.xz | xz --decompress --stdout | docker exec -e "MYSQL_PWD=password" -i project_mysql_1 mysql -uroot database_name
@sethfischer
sethfischer / .gitattributes
Created February 19, 2015 07:09
Drupal 8 .gitattributes export-ignore template
# Files to exclude when creating archive
## General
*.git export-ignore
*.gitignore export-ignore
*.gitattributes export-ignore
*README.* export-ignore
*readme.* export-ignore