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 | |
echo "Please wait. It can take a while..." | |
fallocate -l 1G /swapfile | |
dd if=/dev/zero of=/swapfile bs=1024 count=1048576 | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
mount -a | |
echo |
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
import datetime | |
import os | |
import time | |
while True: | |
now = datetime.datetime.now() | |
print now.hour, now.minute | |
sayit = 'say %d:%d' % (now.hour, now.minute) | |
os.system(sayit) | |
time.sleep(60) |
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
public static boolean isServiceRunning(Context context, String className) { | |
ActivityManager manager = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE); | |
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){ | |
if(className.equals(service.service.getClassName())) { | |
return true; | |
} | |
} | |
return false; | |
} |