Skip to content

Instantly share code, notes, and snippets.

@mikaelj
mikaelj / jlcpcb-postprocess.py
Created March 1, 2023 07:45
Process JLCPCB Fabrication Toolkit in Kicad 7.x to satisfy JLCBPCB assembly service input format
#!/usr/bin/env python3
#
# Process JLCPCB Fabrication Toolkit in Kicad 7.x to satisfy JLCBPCB assembly service input format
#
import sys, os, csv
#
# App
return BlocListener<MyBloc, MyState>(
listener: (context, state) {
if (state is QuestionState && state.attempts == 0) {
final attempts = state.attempts;
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return BlocBuilder<MyBloc, MyState>(
builder: (context, state) {
/* pseudo-ish code
The code can be somewhat simplified by showing the dialog directly in onPressed().
But since the dialog can't be dismissed w/o a BuildContext, I'd still have to listen for a state,
so it's cleaner to treat both show/dismiss the same way, i.e. by listening to DataBloc's state change.
The problem with all of this, as you can see, is that the many of the events and states serve no other
purpose than to display the dialog. Specifically, ItemTransmogrifyStartedEvent/State, ItemTransmogrifyDoneEvent/State.
My question here: how would you go about this?
*/
/*
* Anonymous functions using GCC statement expressions. (from http://stackoverflow.com/questions/10405436/anonymous-functions-using-gcc-statement-expressions)
*
* They capture variables, too!
*
* Output:
Timer at 0x7fffffffde70
Callback w/ cookie 0x7fffffffde70, truth 42.
*/
@mikaelj
mikaelj / shc.inc
Created March 2, 2016 06:22
shc and failed builds
SRC_URI="https://github.com/existz/shc-3.8.9/archive/master.tar.gz;protocol=git \
file://fix-strip.patch \
"
RECIPE_TYPES = "native"
S = "${SRCDIR}/shc-3.8.9-master"
inherit c
do_compile() {
@mikaelj
mikaelj / do_configure.log
Created March 1, 2016 07:53
do_configure log for glibc-2.23 on x86
running prefunc do_configure_siteinfo
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libanl
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libbrokenlocale
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libc
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libcidn
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libcrypt
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libdl
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libm
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libnsl
WARNING: cannot emit var with '-' to bash: LIBRARY_VERSION_glibc-libnss-compat
@mikaelj
mikaelj / duplicates.py
Last active November 22, 2015 09:51
Print out duplicate entries
## untested!
def main():
try:
f = open("r", sys.argv[1])
except:
print "usage: %s file" % (sys.argv[0])
entries = {}
for line in f.readlines():

Keybase proof

I hereby claim:

  • I am mikaelj on github.
  • I am mikaelj (https://keybase.io/mikaelj) on keybase.
  • I have a public key whose fingerprint is A961 080E 4AC3 A487 6B98 4F28 A6D4 78F5 E214 7ECF

To claim this, I am signing this object:

@mikaelj
mikaelj / .vimrc
Created September 19, 2013 09:45
vimrc
set nocompatible
set backspace=indent,eol,start
set ruler
set showcmd
set wildmenu
set fo=cqrt
set laststatus=2
"set textwidth=78
set textwidth=0
set ww=<,>,h,l
@mikaelj
mikaelj / xorg.conf
Last active December 19, 2015 02:39
xorg.conf for triple monitors (one portrait, two landscape) with two nvidia video cards.
# Configuration file for triple-head setup using a GT610 (first slot) and a 8500GT (second slot)
#
# Physical layout like this (not to scale).
# _________
# | |
# | 20" |
# _____ | |
# |r 23"| |_________|
# | o | ____________
# | t | | |