Skip to content

Instantly share code, notes, and snippets.

@asif-mistry
asif-mistry / Endwork
Last active February 4, 2021 13:12
Batch files for usage
TASKKILL /IM chrome.exe
TASKKILL /IM devenv.exe
TASKKILL /IM skype.exe /f
TASKKILL /IM java.exe /f
TASKKILL /IM studio64.exe /f
TASKKILL /IM vncviewer.exe
TASKKILL /IM notepad++.exe
ScrollLock::
{
Send, ^c
Sleep 50
Run, https://www.google.co.in/search?f=%clipboard%
Return
}
@asif-mistry
asif-mistry / DeviceUID.m
Last active October 18, 2018 08:49 — forked from miguelcma/DeviceUID.m
iOS Unique Device ID that persists between app reinstalls
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
@asif-mistry
asif-mistry / AutoDescribingObjects.swift
Last active June 26, 2018 08:41 — forked from YogevSitton-zz/AutoDescribingObjects.swift
Use auto-describing objects with CustomStringConvertible
extension CustomStringConvertible {
var description : String {
var description: String = ""
if self is AnyObject {
//description = "***** \(type(of: self)) - <\(unsafeAddressOf((self as! AnyObject)))>***** \n"
} else {
description = "***** \(type(of: self)) *****\n"
}
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
@asif-mistry
asif-mistry / Remove_MIUI_Bloatware.bat
Created June 9, 2018 18:27
Batch file to remove preinstalled bloated apps in MIUI devices with ADB
@echo off
set /p Y=Enter adb.exe folder path:
cd %Y%
adb devices
pause
for %%X in (
"com.android.browser"
"com.android.chrome"
"com.android.email"
"com.android.thememanager"
@asif-mistry
asif-mistry / Swift 4 - NSApp Relaunch.swift
Created May 4, 2018 11:12 — forked from KyLeggiero/Swift 4 - NSApp Relaunch.swift
Allows you to re-launch a Cocoa app
import Cocoa
extension NSApplication {
func relaunch(afterDelay seconds: TimeInterval = 0.5) -> Never {
let task = Process()
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep \(seconds); open \"\(Bundle.main.bundlePath)\""]
@asif-mistry
asif-mistry / NSApplication+SelfRelaunch.m
Created May 4, 2018 11:12 — forked from cdfmr/NSApplication+SelfRelaunch.m
Self relaunch of Cocoa application
@implementation NSApplication (Relaunch)
- (void)relaunchAfterDelay:(float)seconds
{
NSTask *task = [[[NSTask alloc] init] autorelease];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:[NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, [[NSBundle mainBundle] bundlePath]]];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:args];
@asif-mistry
asif-mistry / UIColor+Enhance.m
Created November 23, 2017 05:23
objc seed code
//
// Created on 4/16/13.
//
#import "UIColor+Enhance.h"
//#import "JDUtils.h"
@implementation UIColor (Enhance)
- (unsigned int)rgb {
@asif-mistry
asif-mistry / Safe Area for iPhone X.swift
Last active November 16, 2017 07:02
Make iPhone X design without using Safe Area Layout
//https://medium.com/@asifmistry/make-iphone-x-design-without-using-safe-area-layout-84c4bed7f60c
class func getSafeAreaInsets()->UIEdgeInsets
{
if #available(iOS 11, *) {
let window = UIApplication.shared.windows[0]
let insets:UIEdgeInsets = window.safeAreaInsets
return insets
}
else {