Skip to content

Instantly share code, notes, and snippets.

View palmerc's full-sized avatar

Cameron Lowell Palmer palmerc

View GitHub Profile
@palmerc
palmerc / apollo.txt
Created September 29, 2019 13:07 — forked from littlelailo/apollo.txt
Apple Bootrom Bug
This bug was also called moonshine in the beginning
Basically the following bug is present in all bootroms I have looked at:
1. When usb is started to get an image over dfu, dfu registers an interface to handle all the commands and allocates a buffer for input and output
2. if you send data to dfu the setup packet is handled by the main code which then calls out to the interface code
3. the interface code verifies that wLength is shorter than the input output buffer length and if that's the case it updates a pointer passed as an argument with a pointer to the input output buffer
4. it then returns wLength which is the length it wants to recieve into the buffer
5. the usb main code then updates a global var with the length and gets ready to recieve the data packages
6. if a data package is recieved it gets written to the input output buffer via the pointer which was passed as an argument and another global variable is used to keep track of how many bytes were recieved already
7. if all the data was recieved th
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 1b8f812..97485eb 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -2781,7 +2781,7 @@ _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
/* ==================================================================== */
/* the expat interface */
-#include "expat.h"
+#include "expat_internal.h"
@palmerc
palmerc / userpic.sh
Last active March 19, 2024 13:02 — forked from acidprime/userpic.sh
Updating a user's picture from a script
#!/bin/bash
set -e
declare -x USERNAME="$1"
declare -x USERPIC="$2"
declare -r DSIMPORT_CMD="/usr/bin/dsimport"
declare -r ID_CMD="/usr/bin/id"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.cameronpalmer.wireguard</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/wg-quick</string>
<string>up</string>
This app collects no data whatsoever.
@palmerc
palmerc / Autolayout Animation
Last active December 24, 2017 13:54
Demo of a button that changes a constraint
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
var innerViewLeadingConstraint: NSLayoutConstraint?
var innerViewCenterXConstraint: NSLayoutConstraint?
var innerView: UIView?
@palmerc
palmerc / openssl-compile.sh
Created October 25, 2017 14:13
openssl compile for iOS
#!/bin/bash
ARCHS=( "arm" )
OPENSSL_OPTIONS=( "no-deprecated" "no-dtls1" "no-experimental" "no-hw" "no-ssl2" "no-ssl3" "no-camellia" "no-cast" "no-comp" "no-dso" "no-engine" "no-idea" "no-jpake" "no-krb5" "no-md2" "no-md4" "no-mdc2" "no-rc2" "no-rc5" "no-ripemd" "no-seed" "no-srp" "no-store" "no-whirlpool" )
MIN_IOS_VERSION=8.0
for ARCH in "${ARCHS[@]}"; do
SDK=""
CONFIGURE_SWITCH=""
if [ "${ARCH}" == "arm" ]; then
@palmerc
palmerc / boost.cmake
Created October 22, 2017 14:43
Work on a complete iOS boost compile script that rolls up all the necessary architectures
include( ExternalProject )
set( NCPU 8 )
set( MIN_IOS_VERSION 8.0 )
set( BOOST_VERSION 1.63.0 )
set( BOOST_SHA_CHECKSUM 9f1dd4fa364a3e3156a77dc17aa562ef06404ff6 )
set( BOOST_COMPILE_LIBRARIES filesystem system date_time )
set( COMPILE_ARCHITECTURES armv6 armv7 armv7s arm64 )
set( ENABLE_BITCODE true )
@palmerc
palmerc / lipo-libraries.sh
Created October 22, 2017 14:41
A script meant to remove unwanted architectures from static libraries and report missing ones
#!/bin/bash
contains() {
local match="$1"
shift
local list=( "${@}" )
for item in "${list[@]}"; do
if [[ "${item}" == "${match}" ]]; then
echo true
#!/bin/bash
STANDLONE_PREFIX=/Users/palmerc/Development/android-ndk/standalone-r13b
HDF5_PARENT_DIR=${HOME}/Development/HDF5-compile
HDF5_INSTALL_DIR=${HDF5_PARENT_DIR}/HDF5
EMULATOR_NAME_ARM="nexus19-arm"
EMULATOR_NAME_X86="nexus19-x86"
function find_device {
local UUID=$1