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 | |
# sh xxx.sh <password> | |
input=$1 | |
if [ ! "$input" ];then | |
input="default password" | |
fi | |
set -e | |
diskName=$(echo $input | sudo -S diskutil list | grep -e "EFI" | awk '{ print $3 }' | sed -n '1p') |
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 class NativeCrashUtils { | |
public static void crashNatively() { | |
try { | |
Class<?> clazz = Class.forName("dalvik.system.VMDebug"); | |
Method method = reflectMethod(clazz, "crash"); | |
method.setAccessible(true); | |
method.invoke(null); | |
} catch (Exception e) { | |
e.printStackTrace(); |
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
# ENV | |
retraceJar=~/retrace/retrace-*.jar | |
# get input | |
mapping=$1 | |
if [ ! "$mapping" ];then | |
read -p "Input mapping file path: " mapping | |
fi | |
if [ ! -f "$mapping" ];then | |
echo "mapping is not file" |
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
# HTTP REQUEST | |
def http_request(url, method=None, post_data=None, headers=None): | |
''' | |
Args: | |
url: HTTP URL | |
method: GET/POST/.. | |
post_data: <dict> | |
headers: <dict> | |
Returns: <dict> or None |
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
# starting simple HTTP server with Python in background | |
screen -d -m python -m SimpleHTTPServer 7777 | |
# killing process running with screen in background | |
kill -9 `top -n 1 | pgrep screen` |
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
/** | |
* Task dispatcher interface. | |
* Using {@linkplain Maker} to build instance in a simple way. | |
* | |
* @author kaede | |
* @version date 16/10/19 | |
*/ | |
public interface Dispatcher { | |
String TAG = "task.dispatcher"; |
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 class Latch { | |
volatile boolean isNotified; | |
public synchronized void tryNotify() { | |
isNotified = true; | |
notify(); | |
} | |
public synchronized void tryWait(long millis) { | |
try { |
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
/** | |
* Multi-process lock | |
* | |
* @author kaede | |
* @version date 16/9/6 | |
*/ | |
class Locker { | |
public static final int EXPIRED_TIME = 30 * 60 * 1000; // 30 minutes |
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
window.addEventListener('DOMContentLoaded', | |
function() { | |
prompt('domc:' + window.app.getCurrentTime()); | |
}) | |
window.addEventListener('load', | |
function() { | |
prompt('load:' + window.app.getCurrentTime()); | |
}) |
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 void testMediaCodecInfo() { | |
// list media codec | |
int numCodec = MediaCodecList.getCodecCount(); | |
for (int i = 0; i < numCodec; i++) { | |
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); | |
Log.i(TAG, "[kaede][testMediaCodecInfo]" + | |
"=================================== " + codecInfo.getName() + " ==================================="); | |
boolean isEncoder = codecInfo.isEncoder(); | |
Log.d(TAG, "isEncoder = " + isEncoder); |