Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mengwong on github.
  • I am mengwong (https://keybase.io/mengwong) on keybase.
  • I have a public key whose fingerprint is 579A F9D9 5A71 A8BD 5540 2223 66E6 2E50 5A83 DCB4

To claim this, I am signing this object:

all of a sudden the wifi icon in the menubar went to "off"; half a minute later it went back on.
macbook air mid 2013, el capitan
i didn't do anything, i swear!
Jun 25 18:46:56 venice2 kernel[0]: ARPT: 184526.658871: wlc_dump_aggfifo:
Jun 25 18:46:56 venice2 kernel[0]: ARPT: 184526.658897: framerdy 0x0 bmccmd 1 framecnt 1024
Jun 25 18:46:56 venice2 kernel[0]: ARPT: 184526.658930: AQM agg params 0xfef maxlen hi/lo 0x0 0x66fc minlen 0x14 adjlen 0x8
Jun 25 18:46:56 venice2 kernel[0]: ARPT: 184526.658979: AQM agg results 0x8082 len hi/lo: 0x0 0x103 BAbitmap(0-3) 0 0 0 0
@mengwong
mengwong / sg.dmn
Created April 6, 2020 15:57
Resilience & Solidarity Budget, as DMN
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:camunda="http://camunda.org/schema/1.0/dmn" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" id="definitions_0t62h4q" name="SG&#39;s Resilience &#38; Solidarity Budget" namespace="http://camunda.org/schema/1.0/dmn" exporter="dmn-js (https://demo.bpmn.io/dmn)" exporterVersion="8.2.0">
<decision id="decision_13ddh8x" name="Wealth-Based">
<informationRequirement id="InformationRequirement_0gmit98">
<requiredInput href="#InputData_0l1r2fx" />
</informationRequirement>
<informationRequirement id="InformationRequirement_0p71qyg">
<requiredInput href="#InputData_06zht3h" />
</informationRequirement>
<decisionTable id="decisionTable_0b71773">
@mengwong
mengwong / taxcredits.hs
Last active June 12, 2020 14:42
tax Credit A and B, Haskell
#!stack
-- stack --resolver lts-15.12 script
data Person = Person { pname :: String, children :: [Person] }
a = Person "Alice" []
b = Person "Bob" []
c = Person "Carol" [a, b]
data TaxCredit = TaxCredit { tcname :: String, rate :: Person -> Int }
@mengwong
mengwong / taxcredits.py
Last active June 12, 2020 14:44
tax Credit A and B, Python
#!/opt/local/bin/python
# https://twitter.com/mengwong/status/1271434036976603136
from abc import ABC, abstractmethod
class Person:
def __init__(self, children=[]):
self.children = children
@mengwong
mengwong / taxcredits2.hs
Last active June 12, 2020 16:07
tax Credit A, B, and C, via a chain of transformers of the default inherited value
#!stack
-- stack --resolver lts-15.12 script
data Person = Person { pname :: String, children :: [Person] }
a = Person "Alice" []
b = Person "Bob" []
c = Person "Carol" [a, b]
data TaxCredit = TaxCredit { tcname :: String
@mengwong
mengwong / taxc3.hs
Created June 12, 2020 16:51
tax Credit in Haskell, using DSL-like syntax to read more like English
#!stack
-- stack --resolver lts-15.12 script
import Data.List (isPrefixOf)
data Person = Person { pname :: String, children :: [Person] }
a = Person "Alice" []
b = Person "Bob" []
c = Person "Carol" [a, b]
@mengwong
mengwong / taxc4.hs
Created June 12, 2020 17:38
tax Credits using numbers closer to reality
#!stack
-- stack --resolver lts-15.12 script
{-# LANGUAGE MultiWayIf #-}
import Data.List (isPrefixOf)
data Person = Person { pname :: String, children :: [Person], income :: Float }
a = Person "Alice" [] 8000
b = Person "Bob" [] 2000
The primary goal is to swap command and option.
The secondary goal is to remap Caps Lock to Control.
The tertiary goal is to share modifier keys across keyboards, so you can emacs with two keyboards.
The following instructions are good as of 2016-08-24, for OS X El Capitan 10.11.6.
Mac OS Sierra broke Seil support; Seil instructs us to consider Karabiner Elements.
But when Karabiner Elements swaps command and option, it does it for all keyboards;
meaning the native keyboard also gets its command and option swapped, which is bad!
@mengwong
mengwong / wifi.log
Created December 27, 2020 08:05
Wifi constantly bouncing on Catalina
Under 10.15.7, I woke my MacBook Pro from sleep to find the wifi constantly disconnecting and reconnecting, on a 20 second cycle.
I"m leaving this here in case anybody else finds it useful while troubleshooting.
Once it goes through, I'm gonna reboot.
Sun Dec 27 16:02:15.446 Apple80211Set:9543 Processing APPLE80211_IOC_ROAM
Sun Dec 27 16:02:15.446 Apple80211Set:9557 Processing APPLE80211_IOC_ROAM dataRef:0x7fdb05766a10
Sun Dec 27 16:02:15.446 Apple80211Set:9578 CFType is CFData
Sun Dec 27 16:02:17.657 <kernel> postMessage::1349 APPLE80211_M_BSSID_CHANGED received