Skip to content

Instantly share code, notes, and snippets.

View katyo's full-sized avatar

Kayo Phoenix katyo

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(defun read-c-radix (s)
(let ((c (substring s 0 (min (length s) 1))))
(cond ((string= s "2") 2)
((string= c "b") 2)
((string= s "8") 8)
((string= c "o") 8)
((string= s "16") 16)
((string= c "h") 16)
((string= s "10") 10)
((string= c "d") 10))))
@katyo
katyo / Makefile
Last active August 18, 2021 21:04
Excellon Specification
all: excellon.html excellon.pdf
excellon.html: excellon.md
@pandoc $< -o $@
excellon.pdf.md: excellon.md
@cat $< | sed 's/\.png/\.pdf/g' > $@
excellon.pdf: excellon.pdf.md
@pandoc $< --latex-engine=pdflatex -o $@
@katyo
katyo / .gitignore
Last active November 25, 2015 15:49
UglifyJS clossure variables overlapping
node_modules/
dist/
@katyo
katyo / webapp.nix
Last active December 17, 2016 07:33
{options, config, lib, pkgs, ...}:
with lib;
let
cfg = config.webapp;
in {
## Interface ##
options.webapp = {
presets = mkOption {
default = {};
example = literalExample ''
{options, config, lib, pkgs, ...}:
with lib;
let
cfg = config.webapp;
in {
## Interface ##
options.webapp = {
presets = mkOption {
default = {};
example = literalExample ''
@katyo
katyo / bench.js
Last active February 23, 2017 22:15
Comparison of js string testing techniques
var allAttrs = ["abbr","accept","accept-charset","accesskey","action","alt","async","autocomplete","autocomplete","autofocus","autoplay","border","challenge","charset","charset","checked","cite","class","cols","colspan","content","contenteditable","controls","coords","crossorigin","data","datetime","datetime","default","defer","dir","dir","dirname","disabled","download","enctype","for","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","headers","height","hidden","high","href","href","href","hreflang","http-equiv","id","ismap","keytype","kind","label","lang","list","loop","low","manifest","max","max","maxlength","media","mediagroup","method","min","min","minlength","multiple","muted","name","name","name","name","name","name","novalidate","optimum","pattern","placeholder","poster","preload","readonly","rel","required","reversed","rows","rowspan","sandbox","spellcheck","scope","selected","shape","size","sizes","span","src","srcdoc","srclang","start","step","style","tabindex","tar
@katyo
katyo / index.js
Last active December 4, 2018 08:35
rollup-plugin-visualizer crash when rollup-plugin-gzip used
export function main() {}
@katyo
katyo / cpp2c.py
Last active November 26, 2020 06:43
import sys
import os
import re
from optparse import OptionParser
import ConfigParser
try:
import pygccxml
except ImportError:
@katyo
katyo / svd-dump.py
Created June 20, 2020 05:21 — forked from devanlai/svd-dump.py
gdb script for dumping STM32 registers
"""
Utilities for dumping STM32 peripheral registers with tab-completion
Based on a script by vampi-the-frog
Dependencies:
pip install -U cmsis-svd
Usage (inside gdb):
(gdb) source /path/to/svd-dump.py