Skip to content

Instantly share code, notes, and snippets.

View arthurdapaz's full-sized avatar
📱
Tweaking iOS and CI/CDs

Arthur da Paz arthurdapaz

📱
Tweaking iOS and CI/CDs
View GitHub Profile
@arthurdapaz
arthurdapaz / MemPatcher.h
Last active January 3, 2018 16:30
Header for MemPatcher
/*
Runtime MemPatcher - by Arthur da Paz
Completely based on the famous writeData.h
created by Razzile & HackJack for iOSGods.com
Copyright 2016 Arthur da Paz, AP Security Inc
This code is licensed under the GTFC LICENSE, which means
██████╗ ██╗██╗ ██╗███████╗ ████████╗██╗ ██╗███████╗
@arthurdapaz
arthurdapaz / MemPatcher.m
Last active January 14, 2018 19:32
MemPatcher magic lines itself
#import "MemPatcher.h"
vm_object_offset_t calcAddress(vm_object_offset_t offset)
{
const struct mach_header *mach;
mach = _dyld_get_image_header(0);
if (mach->flags & MH_PIE)
{
vm_object_offset_t slide = _dyld_get_image_vmaddr_slide(0);
@arthurdapaz
arthurdapaz / install_bash5.0_macos.sh
Created April 16, 2019 22:59
Script to install bash without brew or wget on MacOS
#!/usr/bin/env bash
# Install Bash 5.0 (MacOS)
VERSION="5.0"
BASH_SHORT="bash-$VERSION"
BASH_SRC="$BASH_SHORT.tar.gz"
BASH_URL="https://ftp.gnu.org/gnu/bash"
BASH_PREFIX="/usr/local"
BASH_PATH="$BASH_PREFIX/bin/bash"
@arthurdapaz
arthurdapaz / install_nano4.1_macos.sh
Created April 16, 2019 23:01
Script to install nano v4.1 on MacOS Mojave
#!/usr/bin/env bash
# Install Nano (www.nano-editor.org) with syntax highlighting (MacOS)
VERSION="4.1"
NANO_SHORT="nano-$VERSION"
NANO_SRC="$NANO_SHORT.tar.gz"
NANO_URL="https://www.nano-editor.org/dist/v4"
NANO_EXTRA="https://github.com/scopatz/nanorc"
@arthurdapaz
arthurdapaz / Setting_upa_new_repo.md
Last active November 7, 2020 15:21 — forked from alexpchin/Setting_upa_new_repo.md
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

REPO="REPO_NAME_HERE"
curl -u 'USER' https://api.github.com/user/repos -d '{"name":"$REPO"}'
touch README.md

git init

@arthurdapaz
arthurdapaz / AVPlayerCrossFade.swift
Created February 26, 2020 15:47 — forked from michaelevensen/AVPlayerCrossFade.swift
Handles cross-fading between two individual AVPlayers, creates a smooth, undulating loop between two AVPlayerItem's.
import UIKit
import AVFoundation
class ViewController: UIViewController {
// Duplicate players to handle optional cross-fading.
let playerQueue = [AVPlayer(), AVPlayer()]
var timeObserverToken: Any?
@arthurdapaz
arthurdapaz / xclean.sh
Created July 25, 2020 00:43
Safely Reset Xcode from 9.3 to 11.6. Clean, clear module cache, Derived Data and Xcode Caches.
#!/bin/zsh
############
### zsh script to clear xcode caches and project
###
### Works from Xcode 9.3 to Xcode 11.6
###
### last date I tested: (7/24/2020)
###
### Move this script to /usr/bin/local so this will be the default usage:
### cd myXcodeWorkspace/
#if DEBUG
import SwiftUI
protocol UIViewControllerRepresentableHelper: UIViewControllerRepresentable {
var configuration: (UIViewControllerType) -> () { get set }
}
extension UIViewControllerRepresentableHelper {
func makeUIViewController(context: Context) -> UIViewControllerType { UIViewControllerType() }
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { configuration(uiViewController) }
@arthurdapaz
arthurdapaz / MoveMouse.js
Created July 16, 2021 01:29 — forked from deanishe/MoveMouse.js
JXA: Move mouse to centre of frontmost window
ObjC.import('stdlib')
ObjC.import('CoreGraphics');
// Move mouse cursor to specified position
function moveMouse(x, y) {
var pos = $.CGPointMake(x, y);
var event = $.CGEventCreateMouseEvent(null, $.kCGEventMouseMoved, pos, $.kCGMouseButtonLeft);
$.CGEventPost($.kCGHIDEventTap, event);
}
@arthurdapaz
arthurdapaz / FileManager.js
Created July 16, 2021 01:33 — forked from uchcode/FileManager.js
JXA - FileManager
const FileManager = (()=>{
function pwd() {
return $.NSFileManager.defaultManager.currentDirectoryPath.js
}
function cd(path='~') {
if (path==='') path = '.'
let p = $(path).stringByStandardizingPath
let r = $.NSFileManager.defaultManager