Skip to content

Instantly share code, notes, and snippets.

import simd
extension float4x4 {
init(scaleBy s: Float) {
self.init(SIMD4<Float>(s, 0, 0, 0),
SIMD4<Float>(0, s, 0, 0),
SIMD4<Float>(0, 0, s, 0),
SIMD4<Float>(0, 0, 0, 1))
}
@chriswill0w
chriswill0w / Obfuscator.swift
Last active February 17, 2021 07:49 — forked from DejanEnspyra/Obfuscator.swift
Obfuscation of hard-coded security-sensitive strings.
protocol ObfuscatorProtocol {
#if DEBUG
func bytesByObfuscatingString(_ string: String) -> [UInt8]
#endif
func reveal(_ key: [UInt8]) -> String
}
class Obfuscator: ObfuscatorProtocol {
// MARK: - Variables
@kylecampbell
kylecampbell / k_means_clustering.py
Last active December 1, 2023 07:00
K-Means Clustering with Tensorflow
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import seaborn as sns
#uncomment below if using Jupyter
#%config InlineBackend.figure_format = 'retina'
# get data
df = pd.read_csv('../some/data/path')
/*
* SEP firmware split tool
*
* Copyright (c) 2017 xerub
*/
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@j-j-m
j-j-m / commonprofile.metal
Created May 8, 2017 00:20
Can't access GL Uniforms in Metal shader modifier? Apple docs for SCNShadable written in terms of GL? Pulling your hair out?... this will help.
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
@atsepkov
atsepkov / universal-framework.sh
Last active February 18, 2021 06:26 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures). This version works with Cocoapods, merging simulator and device architectures for intermediate libraries as well. To use this script, go to Product > Scheme > Edit S…
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@xoppa
xoppa / outline.fragment.glsl
Created October 12, 2015 20:42
very basic outline shader
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
const float offset = 1.0 / 128.0;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@steipete
steipete / FilterScriptPhase.sh
Created April 27, 2015 16:25
This filter script phase is required to remove unused architectures from your application, which would be flagged as issue during upload to the Apple AppStore. Read more at http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing