Skip to content

Instantly share code, notes, and snippets.

View macshome's full-sized avatar

Josh Wisenbaker macshome

View GitHub Profile
@clee
clee / voron_sensorless.md
Last active April 24, 2024 19:25
how to sensorless XY on Vorons

Setting Up and Calibrating Sensorless XY Homing

When using the TMC2130 / TMC2209 / TMC2660 / TMC5160 drivers, the StallGuard feature makes it possible to set up sensorless homing on the X and Y axes for CoreXY machines. The Klipper project has a page with documentation and recommendations on getting it working.

Following are some more detailed instructions and suggestions to supplement the Klipper documentation specifically for Vorons.

Hardware Setup

@sunflsks
sunflsks / oahd-wrapper.c
Last active January 12, 2024 07:09
convert an x86 bin to an arm through oahd-helper
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
void help(char* curbin) {
fprintf(stderr, "%s x86_bin arm64_output\n", curbin);
}
int main(int argc, char** argv) {
csrutil disable
sudo nvram boot-args="intcoproc_unrestricted=1 kext-dev-mode=1 amfi_allow_any_signature=1 amfi_unrestrict_task_for_pid=1 PE_i_can_has_debugger=1 cs_enforcement_disable=1 amfi_get_out_of_my_way=1 amfi=0xff cs_debug=1 ipc_control_port_options=0"
sudo spctl --global-disable
sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO
sudo defaults write /Library/Preferences/com.apple.security.coderequirements Entitlements -string always
sudo defaults write /Library/Preferences/com.apple.security.coderequirements AllowUnsafeDynamicLinking -bool YES
sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool YES
defaults write com.apple.loginwindow DisableScreenLockImmediate -bool yes
import Foundation
func cost(_ mass: Int) -> Int {
return (mass/3) - 2
}
func moduleCost(_ mass: Int, _ sum: Int = 0) -> Int {
let remainder = cost(mass)
let sum = sum + remainder
if cost(remainder) <= 0 {
@MCJack123
MCJack123 / ipsw_keys.py
Last active December 1, 2023 22:46
Extract iOS firmware keys using on-device AES engine
#!/usr/bin/env python
from sys import argv, stdout
from os import system, remove, path
from urlparse import urlparse
import re
import dfu
import ssl
import math
import json
import getopt
@JoeMatt
JoeMatt / Set Plist Bundle to Git Count.md
Last active November 25, 2023 10:18
Xcode 10 set Info.plist build version

Create Info.plist

About

This script will update Info.plist of a target in XCode with the following

  1. CFBundleVersion to the git commit count
  2. GitDate to the date of the last commit
  3. GitBranch to the current branch name
  4. GitTag to the latest tag on current branch

Creates a .version file to track last update and appease XCode needing a non-mutable output path.

#!/usr/bin/python3
'''
Display CPU usage for a given process
emoji ref: https://github.com/sheagcraig/Spruce/blob/master/spruce.py
'''
import subprocess
import time
import argparse
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@mattlawer
mattlawer / DisableGDB.swift
Created December 25, 2016 17:13
Disable GDB with Swift 3
import Foundation
func disable_gdb() {
let PT_DENY_ATTACH: CInt = 31
let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW)
let sym = dlsym(handle, "ptrace")
typealias PtraceAlias = @convention(c) (CInt, pid_t, CInt, CInt) -> CInt
let ptrace = unsafeBitCast(sym, to: PtraceAlias.self)
_ = ptrace(PT_DENY_ATTACH, 0, 0, 0)
dlclose(handle)
@rudelm
rudelm / autofs.md
Last active April 29, 2024 02:26
Use autofs on Mac OS X to mount network shares automatically during access

Autofs on Mac OS X

With autofs you can easily mount network volumes upon first access to the folder where you want to mount the volume. Autofs is available for many OS and is preinstalled on Mac OS X so I show you how I mounted my iTunes library folder using this method.

Prepare autofs to use a separate configuration file

autofs needs to be configured so that it knows where to gets its configuration. Edit the file /etc/auto_master and add the last line:

#
# Automounter master map
#

+auto_master # Use directory service