This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // task_for_pid leak | |
| // **IMPORTANT** To reproduce this bug, you have to sign this program with a developer ID -- do not use a self-signed certificate or run as root! | |
| // This code will cause taskgated's memory usage to grow (see activity monitor) | |
| // Link to Xcode project with included info.plist: http://tinyurl.com/kps28av | |
| // Radar 16230826 | |
| #include <mach/mach_init.h> | |
| #include <mach/task.h> | |
| #include <mach/mach_port.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <libproc.h> | |
| #import <stdlib.h> | |
| #import <stdio.h> | |
| int main( int argc, const char * argv[]) | |
| { | |
| pid_t * pids = calloc(0x4000, 1); | |
| int count = proc_listallpids(pids, 0x4000); | |
| printf("count=%u\n", count) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/sbin/dtrace -C -s | |
| #pragma D option quiet | |
| proc::posix_spawn:exec-success,proc::__mac_execve:exec-success | |
| { | |
| this->isx64=(curproc->p_flag & P_LP64)!=0; | |
| #define SELECT_64_86(x64, x86) (this->isx64 ? (x64) : (x86)) | |
| #define GET_POINTER(base, offset) (user_addr_t)SELECT_64_86(*(uint64_t*)((base)+sizeof(uint64_t)*(offset)), *(uint32_t*)((base)+sizeof(uint32_t)*(offset))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import "NetworkMonitor.h" | |
| NSString *NetworkConfigurationDidChangeNotification = @"NetworkConfigurationDidChangeNotification"; | |
| void storeCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) { | |
| [(NetworkMonitor *)info update]; | |
| } | |
| @implementation NetworkMonitor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Copied, Pasted and summarized from ps' source code. | |
| You can use sysctl to get other process' argv. | |
| */ | |
| #include <sys/sysctl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define pid_of(pproc) pproc->kp_proc.p_pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)scrollViewDidScroll:(UIScrollView *)sender { | |
| BOOL isScrollingRight = _scrollView.contentOffset.x > _previousContentOffsetX; | |
| _mostRecentScrollWasRight = isScrollingRight; | |
| _previousContentOffsetX = _scrollView.contentOffset.x; | |
| CGFloat pageWidth = _scrollView.frame.size.width; | |
| int scrollingToPageNum = isScrollingRight ? (ceil((_scrollView.contentOffset.x - pageWidth) / pageWidth) + 1) : (floor((_scrollView.contentOffset.x -pageWidth) / pageWidth) + 1); | |
| int percentOfScrollToPageOnscreen = isScrollingRight ? floor((((int)_scrollView.contentOffset.x % (int)pageWidth) / pageWidth)*100) |
NewerOlder