Skip to content

Instantly share code, notes, and snippets.

@osfunapps
osfunapps / apple_device_connection_helper.command
Last active November 7, 2022 19:12
Just connect your device and run this command, it will connect until a fully steady connection achieved
# removefrom quarantine:
# sudo xattr -rd com.apple.quarantine "/Users/home/Programming/Python/projects/ToolBoxPy/src/linux/connectPhone.command"
# This small script meant to save Apple users the hassle of resetting/disconnecting and connecting an Apple device, again and again, until a steady connection.
# Just connect your device and run this command, it will reconnect the device until a steady connection
# set here the sensitivity of the checks. I fount it best to use these props
MAX_PASSED_CHECKS=50
TIMEOUT_BETWEEN_CHECKS=0.3 # in secs
TIMEOUT_AFTER_EACH_USB_RESET=4 # in secs
@osfunapps
osfunapps / HttpResParser.kt
Created June 8, 2020 12:09
a simple class to turn a raw http res to an object with status, reason and headers
class HttpResParser {
companion object {
fun parseRawHttpStringRes(httpRes: ByteArray): HttpRes {
val br = ByteArrayInputStream(httpRes).bufferedReader()
val version: String
val statusCode: String
val reason: String
@osfunapps
osfunapps / ss_creator.command
Created May 4, 2020 07:02
Will install an apk, take screen shots and a bunch of other things using Android's ADB
#!/usr/bin/env bash
APK_VERSION_NUMBER=2
APPS_ROOT_PATH="/Users/home/Desktop/stock_exchange/latest_work/appr_14_"
# Will initiate the adb cycle
start_adb_ss_cycle () {
# create ss dir
ss_dir="$1/ss"
@osfunapps
osfunapps / old_launcher_files_remover.py
Created April 5, 2020 07:25
Will remove old launcher files in .py
def clear_old_launcher_files(self):
import os_tools.FileHandler as fh
launcher_made_files = fh.search_files(PROJECT_MAIN_PATH, None, 'ic_launcher')
fh.remove_files(launcher_made_files)
@osfunapps
osfunapps / copy_dynamic_xml_files.py
Created April 4, 2020 11:00
Will copy a main dir of colors to respected dirs
from os_tools import FileHandler as fh
COLORS_MAIN_DIR = '/Users/home/Desktop/work/Apps/untitled folder/main_dir_fixed_colors'
COLORS_TO_INJECT_MAIN_DIR = '/Users/home/Desktop/work/Apps/untitled folder/no_good_color_apps'
# fetch all of the color xml files from the colors main dir
color_xmls = fh.search_files(COLORS_MAIN_DIR, 'dynamic_colors.xml')
# fetch all of the dirs to run on
@osfunapps
osfunapps / PointerExtensions.swift
Created February 18, 2020 09:28
readUInt8 readUInt16 readUInt32 readUInt64 writeUInt8 writeUInt16 writeUInt32 writeUInt64 littleendian bigendian
import Foundation
extension UnsafeBufferPointer where Element == UInt8 {
/// Will read 4 bytes from a buffer to a single (little endian) int
func readUInt32LE(offset: Int) -> UInt32 {
var arr: UnsafeBufferPointer<UInt8>? = UnsafeBufferPointer<UInt8>.init(rebasing: self[offset...offset + 4])
let uint32Val = arr!.baseAddress!.withMemoryRebound(to: UInt32.self, capacity: 1) { $0 }.pointee
arr = nil