This file contains 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
/* Utilities */ | |
var RANDOM = function() {}; | |
function _randomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function _randomHex(len) { | |
var hex = '0123456789abcdef'; |
This file contains 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/bash | |
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it! | |
# IMPORTANT: You will need to run this script from Normal Mode's Terminal. | |
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars. | |
# Get active services: launchctl list | grep -v "\-\t0" | |
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents | |
# Agents to disable |
This file contains 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
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public static String getForegroundProcess(Context context) { | |
String topPackageName = null; | |
UsageStatsManager usage = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); | |
long time = System.currentTimeMillis(); | |
List<UsageStats> stats = usage.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000*1000, time); | |
if (stats != null) { | |
SortedMap<Long, UsageStats> runningTask = new TreeMap<Long,UsageStats>(); | |
for (UsageStats usageStats : stats) { | |
runningTask.put(usageStats.getLastTimeUsed(), usageStats); |