Skip to content

Instantly share code, notes, and snippets.

View markuscraig's full-sized avatar

Mark Craig markuscraig

  • Jubilant
  • San Jose, CA
View GitHub Profile
@markuscraig
markuscraig / gist:9dbc28a2510d5d90f96cc136a958f4a1
Last active November 26, 2025 22:30
3DxNLServer dtrace of args passed to bind() calls
$ sudo dtrace -c "/Applications/3Dconnexion/3DxNLServer/3DxNLServer.app/Contents/MacOS/3DxNLServer" \
-n 'syscall::bind:entry /execname=="3DxNLServer"/ { trace(arg0); trace(copyinstr(arg1)); }' \
-f bind 2>&1 | tee ~/3DxNLServer_dtrace_bind.txt
dtrace: description 'syscall::bind:entry ' matched 1 probe
dtrace: description 'bind' matched 2 probes
dtrace: pid 1830 has exited
CPU ID FUNCTION:NAME
13 376 bind:entry 16
@markuscraig
markuscraig / gist:e596962a5f0c7a1412e6da0aed9977bd
Last active November 26, 2025 22:23
3DxNLServer dtruss trace of all sys calls (including dynamic buffer)
$ sudo dtruss -f -b 32m \
/Applications/3Dconnexion/3DxNLServer/3DxNLServer.app/Contents/MacOS/3DxNLServer
PID/THRD SYSCALL(args) = return
1472/0x77dc: fork() = 0 Err#1
1472/0x77dc: proc_info(0xF, 0x5C0, 0x0) = 0 0
1472/0x77dc: thread_selfid(0x0, 0x0, 0x0) = 30684 0
1472/0x77dc: crossarch_trap(0x0, 0x0, 0x0) = -1 Err#45
1472/0x77dc: csrctl(0x0, 0x16B5F717C, 0x4) = -1 Err#1
@markuscraig
markuscraig / leopold_fc660c_programming.md
Last active May 21, 2022 11:40
Leopold FC660C TMK Keymap Programming

Leopold FC660C TMK Keymap Programming

  1. Build a keymap and download the TMK firmware (.hex file)
  2. Install flash programming tools...
    • Mac
      • $ brew tap osx-cross/avr
      • $ brew install avr-gcc
      • $ brew install dfu-programmer
    • Linux / Windows
  • Use the 'Atmel FLIP' app
@markuscraig
markuscraig / sync_gdrive.py
Last active January 7, 2025 07:54
Rclone + Google Drive sync script
#!/usr/bin/env python
import os
import shutil
import subprocess
# global variables
SYNC_DIRS = [
{
'src': "/Volumes/PhotoArchive/Lightroom",
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug 'Pace Errors by Firmware'" type="PythonConfigurationType" factoryName="Python" singleton="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="PYTHONPATH" value="$SPARK_HOME/python;$SPARK_HOME/python/lib/py4j-0.10.3-src-zip" />
<env name="SPARK_HOME" value="/usr/local/spark" />
</envs>
<option name="SDK_HOME" value="$PROJECT_DIR$/venv/bin/python" />
@markuscraig
markuscraig / Debug_SparkTest.xml
Created October 17, 2016 22:34
Shared PyCharm 'Run Configuration' for a basic Spark integration test
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug SparkTest" type="PythonConfigurationType" factoryName="Python" singleton="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONPATH" value="$SPARK_HOME/python;$SPARK_HOME/python/lib/py4j-0.10.3-src.zip" />
<env name="PYTHONUNBUFFERED" value="1" />
<env name="SPARK_HOME" value="/usr/local/spark" />
</envs>
<option name="SDK_HOME" value="/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7" />
@markuscraig
markuscraig / gist:770097c1ae53d565354af9e8b41c6093
Created May 10, 2016 19:33
Emanate 'Streaming Event' notification using the 'Cisco MSE JSON' data format
{
"StreamingNotification": {
"timestamp": "2016-05-10T12:14:38-07:00",
"deviceId": "11:22:33:44:55:66",
"subscriptionName": "Mainspring-Event-Stream",
"entity": "TAGS",
"floorRefId": 0,
"mseUdi": "AIR-MSE-3355-K9:V01:KQ37VL6",
"location": {
"BatteryInfo": {
@markuscraig
markuscraig / gist:92ad145a66a76d44d164
Created February 24, 2016 16:19
Example MSE JSON Notification
{
"StreamingNotification" : {
"deviceId" : "f0:ad:4e:03:21:d3",
"entity" : "TAGS",
"floorRefId" : 0,
"location" : {
"BatteryInfo" : {
"batteryAge" : 0,
"daysRemaining" : 98,
"lastReceivedSeqNum" : 54,
{
"StreamingNotification":{
"deviceId":"f0:ad:4e:03:21:ab",
"entity":"TAGS",
"floorRefId":0,
"location":{
"BatteryInfo":{
"batteryAge":0,
"daysRemaining":100,
"lastReceivedSeqNum":58,