Skip to content

Instantly share code, notes, and snippets.

View palmerc's full-sized avatar

Cameron Lowell Palmer palmerc

View GitHub Profile
import UIKit
public struct Pixel {
public var value: UInt32
public var red: UInt8 {
get {
return UInt8(value & 0xFF)
}
set {
@palmerc
palmerc / HDF5 Android How-to
Created February 3, 2017 08:36
Instructions on getting through HDF compilation for Android
How to build HDF5 for Android
References:
-----------
[1] http://developer.android.com/tools/sdk/ndk/index.html
[2] http://developer.android.com/sdk/index.html
#!/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
@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
@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 / 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 / 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?
This app collects no data whatsoever.
<?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>
@palmerc
palmerc / userpic.sh
Last active May 26, 2024 10:44 — 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"