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
+ (NSString *)platform{ | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *machine = malloc(size); | |
sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
NSString *platform = [NSString stringWithUTF8String:machine]; | |
free(machine); | |
return platform; | |
} |
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 | |
package=<Your Package> | |
appname=<Your App Name> | |
level=0 | |
if [ "$1" == "build" ]; then | |
level=0 | |
if [ "$2" == "java" ]; then |
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
背景:一般的mkv,視頻用的是h264,音頻用的是AC3,蘋果都支持,但mkv這種封裝格式蘋果不支持。 | |
此命令是一個事例,適用于一般的mkv,此處不做視頻和音頻重編碼,只修改封裝格式,同時還把外掛字幕一並打上。 | |
只轉封裝不重編碼的好處是速度快,基本相當于硬盤拷貝。 | |
轉碼前最好先ffmpeg -i a.mkv看一下視頻信息再看要怎樣轉碼,具體信息可參考ffmpeg.org官方文檔 | |
ffmpeg -i a.mkv -i a.eng.srt -map 0:0 -map 0:1 -map 1:0 -vcodec copy -acodec copy -scodec mov_text -metadata:s:s:0 language=eng -y b.mp4 |
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
final View activityRootView = getWindow().getDecorView().findViewById(R.id.post_editor_dialog); | |
if (activityRootView != null) { | |
ViewTreeObserver observer = activityRootView.getViewTreeObserver(); | |
if (observer != null) { | |
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
int lastHeightDiff; | |
@Override | |
public void onGlobalLayout() { | |
View rootView = activityRootView.getRootView(); | |
if (rootView != null) { |
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
<style name="PopupTheme" parent="android:Theme.Holo.Light.Dialog"> | |
<item name="android:windowIsFloating">false</item> | |
<item name="android:windowContentOverlay">@null</item> | |
<item name="android:windowSoftInputMode">stateAlwaysVisible</item> | |
<item name="android:windowActionModeOverlay">true</item> | |
<item name="android:windowIsTranslucent">true</item> | |
</style> | |
<style name="PostTheme" parent="@android:style/Theme.Holo.Light"> | |
<item name="android:actionBarStyle">@style/PostTheme.ActionBar</item> |
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
TV.setText("bla"); | |
TV.measure(0, 0); //must call measure! | |
TV.getMeasuredHeight(); //get width | |
TV.getMeasuredWidth(); |
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
#include <sys/time.h> | |
struct timeval tv; | |
gettimeofday(&tv, NULL); | |
double st = tv.tv_sec * 1.0 + tv.tv_usec / 1000000.0; |
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
jclass native_class = (*env)->GetObjectClass(env, this); | |
jmethodID method_decodedFrame = (*env)->GetMethodID(env, native_class, "decodedFrame", "([I)V"); | |
(*env)->CallVoidMethod(env, this, method_decodedFrame, result); |
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
local_ip= | |
local_port= | |
remote_ip= | |
remote_port= | |
iptables -t nat -A PREROUTING -d $local_ip -p tcp --dport $local_port -j DNAT --to-destination $remote_ip:$local_port | |
iptables -t nat -A POSTROUTING -d $remote_ip -p tcp --dport $remote_port -j SNAT --to $local_ip | |
iptables -A FORWARD -o eth1 -d $remote_ip -p tcp --dport $remote_port -j ACCEPT | |
iptables -A FORWARD -i eth1 -s $remote_ip -p tcp --sport $remote_port -j ACCEPT |
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
date +%s |
OlderNewer