Skip to content

Instantly share code, notes, and snippets.

View adel-ezzat's full-sized avatar
😎

Adel ezzat adel-ezzat

😎
View GitHub Profile
@adel-ezzat
adel-ezzat / gist:7e4aa8adedd82bd479235bea166e8bbc
Created April 14, 2020 11:04 — forked from snikch/gist:3661188
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@galanteh
galanteh / install.sh
Last active April 2, 2023 18:13
Install Megatools on CentOS 7. Megatools are the commands to be used on linux
#!/bin/bash
yum -y install gcc make glib2-devel libcurl-devel openssl-devel gmp-devel tar automake autoconf libtool wget asciidoc
wget https://megatools.megous.com/builds/megatools-1.10.0-rc1.tar.gz
tar -xzvf megatools*.tar.gz
cd megatools*
./configure
make
make install
# megadl 'https://mega.nz/#xxxxxxxxxxx!'
@rosswd
rosswd / reset.md
Created June 4, 2019 22:29
SMC and PRAM reset on non T2-Security chip Intel Macbooks

TLDR

  • Power issues, do an SMC reset. Display resolution, sound or startup disk issues, do a PRAM reset.

SMC Reset

  • Apple Menu > Shut Down
  • Shift + Ctrl + Opt (left side) & Power button at the same time. Hold for 10 seconds.
  • Release all keys
  • Power on your Mac

PRAM Reset

@Razzile
Razzile / writeData.h
Last active January 21, 2022 21:03
writeData using MSHookMemory as a backend for iOS 12
//**************************************************//
//**This Header File is used in combination********//
//**with a dynamic Library and must be rewritten**//
//**if you want to use it for another purpose****//
//**********************************************//
//******************************************//
//**Credits: HackJack & Razzile(Kamizoom)**//
//****************************************//
@miguelmota
miguelmota / util.php
Last active July 31, 2024 09:14
PHP byte array to hex, hex to byte array, string to hex, hex to string utility functions
<?php
function string2ByteArray($string) {
return unpack('C*', $string);
}
function byteArray2String($byteArray) {
$chars = array_map("chr", $byteArray);
return join($chars);
}
@JohnCoates
JohnCoates / AutoHook.h
Created May 26, 2017 22:06
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end
@dreness
dreness / manual-ocsp-check.txt
Last active May 7, 2020 22:48
Manually check #codesigning #certificate revocation status using OCSP
# Assumes an Apple-like layout: leaf --> issuer --> CA in exactly 3 certs
# The last arg to codesign specifies the code to check, by bundle or executable path, or process ID
codesign -d -vv --extract-certificates=cert I-didnt-edit-my-config-file
for i in 0 1 2 ; do openssl x509 -inform der -in cert${i} -out cert${i}.pem ; done
openssl ocsp -CAfile cert2.pem -issuer cert1.pem -cert cert0.pem -url $(openssl x509 -in cert0.pem -ocsp_uri -noout)
Example:
╭─ andre@flux ~
@RadGH
RadGH / short-number-format.php
Last active February 25, 2025 21:33
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@joswr1ght
joswr1ght / catchredir.m
Last active June 8, 2021 11:50
Demonstration code to detect runtime method swizzling with Cydia Substrate/Cycript.
// Compile with:
// clang catchredir.m -o catchredir -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -miphoneos-version-min=7 -framework Foundation
#import <Foundation/Foundation.h>
#import <stdio.h>
#import <objc/runtime.h>
@interface UrlConnection : NSObject
@property (strong) NSString *url;
- (void)connect;
@end
@Sunnyztj
Sunnyztj / gist:9661609
Created March 20, 2014 11:14
compare time in objective c
+(int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy"];
NSString *oneDayStr = [dateFormatter stringFromDate:oneDay];
NSString *anotherDayStr = [dateFormatter stringFromDate:anotherDay];
NSDate *dateA = [dateFormatter dateFromString:oneDayStr];
NSDate *dateB = [dateFormatter dateFromString:anotherDayStr];
NSComparisonResult result = [dateA compare:dateB];
NSLog(@"date1 : %@, date2 : %@", oneDay, anotherDay);