Skip to content

Instantly share code, notes, and snippets.

Alessandro Saba alessaba

Block or report user

Report or block alessaba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alessaba
alessaba / awsudo.sh
Created Sep 21, 2019
Simple shell function to allow macOS (10.15+) users with an Apple Watch to authenticate sudo requests using the Apple Watch
View awsudo.sh
function awsudo {
osascript -e "do shell script \"$*\" with administrator privileges"
}
View p3comparison.swift
import UIKit
import Foundation
import PlaygroundSupport
UIColor(red: 1.2, green: -0.75, blue: 2, alpha: 1) // Using the extended sRGB color values introduced in iOS 10 to display a wider gamut (P3 in this case)
extension UIColor {
convenience init(displayP3Hue hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat = 1) {
@alessaba
alessaba / pdf_pwd_rm.py
Last active Nov 16, 2017
Pythonista Unlock PDF
View pdf_pwd_rm.py
###############################
# Script made by @ivanmorenoz with a small secure correction from @filippoclaudi #
###############################
# Description: this script uses Pythonista Objc Bridging for unlocking the PDF using PDFKit
from objc_util import ObjCClass, nsurl
from appex import get_file_paths, finish, is_running_extension
from os import remove, path
from console import alert, input_alert, quicklook
@alessaba
alessaba / PlaygroundsFrameworks.swift
Last active May 11, 2019
List of available frameworks in Swift Playgrounds (tldr they removed 38 frameworks from the sdk)
View PlaygroundsFrameworks.swift
import AVFoundation
import AVKit
import Accelerate
import Accounts
import AudioToolbox
import AudioUnit
import CFNetwork
import CoreAudio
import CoreAudioKit
import CoreBluetooth
@alessaba
alessaba / extract_kernelcache
Created Jan 22, 2017
Very simple python script to extract the kernelcache from the device
View extract_kernelcache
#Pythonista needed
import console
console.open_in('/System/Library/Caches/com.apple.kernelcaches/kernelcache')
print('Done!')
View OMColorPicker.py
# coding: utf-8
from objutil import *
import ui
colorpicker = ObjCClass('OMColorPickerViewController').new().autorelease()
clview = colorpicker.view()
clview.frame = CGRect((0, 0), (512, 512))
view = presentUIView(clview, 'Color Picker', 'sheet')
View VolumeControls.py
# coding: utf-8
from objc_util import NSBundle, ObjCClass, on_main_thread
NSBundle.bundleWithPath_('/System/Library/Frameworks/MediaPlayer.framework').load()
MPVolumeView = ObjCClass('MPVolumeView')
volume_view = MPVolumeView.new().autorelease()
@on_main_thread
def set_system_volume(value):
volume_view.subviews()[0].value = value
View Omtab.py
# coding: utf-8
from objc_util import *
import ui
def btnaction(sender):
print 'hellah'
tabvc=ObjCClass('UIApplication').sharedApplication().keyWindow().rootViewController().childViewControllers()[1]
toolbar=tabvc.toolbar()
View NewRightButton.py
# coding: utf-8
from objc_util import *
from ui import Button
def btnaction(sender):
print 'Hello'
toolbar=UIApplication.sharedApplication().keyWindow().rootViewController().childViewControllers()[1].view()
btn=ui.Button(frame=(toolbar.size().width - 152 - 40,22,40,40))
@alessaba
alessaba / JailbreakTest.py
Last active Dec 24, 2015
JailbreakTest.py
View JailbreakTest.py
# coding: utf-8
import os
def is_device_jailbroken():
try:
os.listdir('/private')
except OSError:
return False
return True
You can’t perform that action at this time.