Skip to content

Instantly share code, notes, and snippets.

@shinvou
shinvou / finwin.fish
Created Apr 29, 2018
Fish function to set current working directoy to Finder window path
View finwin.fish
function finwin --description "Set shell working directory to frontmost Finder window path"
set script "
tell application \"Finder\"
if exists Finder window 1 then
set currentDir to target of Finder window 1 as alias
return POSIX path of currentDir
else
return
end if
end tell"
@shinvou
shinvou / build_xnu.sh
Created Dec 4, 2017
Build the macOS High Sierra (10.13.x) xnu kernel.
View build_xnu.sh
#!/bin/bash
#
# This is more or less just a bash script for this tutorial: https://0xcc.re/building-xnu-kernel-macosx-sierrra-10-12-x/
# So, huge thanks to Mikal Villa! I updated the tarballs for macOS 10.13 and added line 29.
#
curl -O https://opensource.apple.com/tarballs/dtrace/dtrace-262.tar.gz && \
curl -O https://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-32.tar.gz && \
curl -O https://opensource.apple.com/tarballs/libdispatch/libdispatch-913.1.6.tar.gz && \
curl -O https://opensource.apple.com/tarballs/libplatform/libplatform-161.tar.gz
View Tweak.xm
%hook SBApplication
- (BOOL)iconIsRecentlyUpdated:(id)icon
{
// icon is either SBApplicationIcon or SBUserInstalledApplicationIcon, which is a subclass of SBApplicationIcon
return NO;
}
%end
@shinvou
shinvou / Tweak.xm
Last active Aug 29, 2015
Submarinated
View Tweak.xm
%hook SBApplication
- (BOOL)iconIsBeta:(id)icon
{
// icon is either SBApplicationIcon or SBUserInstalledApplicationIcon, which is a subclass of SBApplicationIcon
if ([[self bundleIdentifier] isEqualToString:@"com.insanj.submarine"]) return NO;
return %orig;
}
@shinvou
shinvou / RememberThisCode.xm
Created Aug 18, 2015
Present notifications that keep in notification center
View RememberThisCode.xm
extern "C" CFTypeRef SecTaskCopyValueForEntitlement(void* task, CFStringRef entitlement, CFErrorRef *error);
static void PresentBannerWithMessageForIdentifier(NSString *message, NSString *identifier, NSDictionary *userInfo)
{
UILocalNotification *notification = [objc_getClass("UILocalNotification") new];
[notification setAlertBody:message];
[notification setUserInfo:userInfo];
//[notification setApplicationIconBadgeNumber:0];
[notification setHasAction:YES];
[notification setAlertAction:nil];
You can’t perform that action at this time.