Skip to content

Instantly share code, notes, and snippets.

View dmpatel151282's full-sized avatar

Dharmesh Patel dmpatel151282

View GitHub Profile
Open the following file from Android framework.
- /android/frameworks/base/services/java/com/android/server/ConnectivityService.java
- Add below code at appropriate place.
// the set of network types that can only be enabled by system/sig apps
List mProtectedNetworks;
+// Wifi/Eth coexist strategy V0.3
+private NetworkInfo mSecondaryNetworkInfo = null;
Open the following file from Android framework.
- /android/frameworks/base/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
- Go to "doKeyguardLocked(Bundle options)" function.
- Add below code at appropriate place.
+final boolean disableLockScreenForever = SystemProperties.getBoolean("keyguard.disable", true);
+if(disableLockScreenForever){
Ethernet:-
- Make ethernet_bw.sh file.
- Copy below code snippet in file.
#!/bin/sh
INTERVAL="1" # update interval in seconds
while true
do
R1=`cat /sys/class/net/eth0/statistics/rx_bytes`
T1=`cat /sys/class/net/eth0/statistics/tx_bytes`
ip link add link eth0 name eth0.$VLAN_ID type vlan id $VLAN_ID
eg. ip link add link eth0 name eth0.100 type vlan id 100 -> Add eth0.100 interface
Unzip "zip" file
Install Dependency :- apt-get install unzip'
Unzip -> unzip file.zip,
unzip file.zip -d destination_folder
Compress/Extract from/to "tar.gz" file
Compress -> tar -zcvf folder1_path folder2_path ... file.tar.gz
Extract -> tar -zxvf file.tar.gz
Merge / convert multiple PDF files into one PDF
1. Download latest apktool version.
2. Download the batch file and aapt.exe.
3. Create a folder anywhere in the PC and put all the apktool.jar, aapt.exe and the batch script in that folder.
4. Open command prompt.
5. Navigate to the folder where you placed apktool.jar, batch script and the aapt.exe.
6. Now, you need to install the file using the " IF " command.
7. Type the following command.
apktool if name-of-the-app.apk
FILE_LIST := $(wildcard $(LOCAL_PATH)/[DIRECTORY]/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
usage: input [text|keyevent]
input text <string>
input keyevent <event_code>
Codes:-
0 --> "KEYCODE_UNKNOWN"
1 --> "KEYCODE_MENU"
2 --> "KEYCODE_SOFT_RIGHT"
3 --> "KEYCODE_HOME"
4 --> "KEYCODE_BACK"
String htmlString =
"<h1>HTML String Title in TextView</h1>\n" +
"<h3>HTML Paragraph:</h3>\n" +
"<p>Display html string in android TextView. How to show HTMl string in android TextView. This html paragraph</p>\n" +
"<h3>HTML Unordered List: </h3>\n" +
"<ol>\n" +
"\t<li>HTML List Item 1</li> \n" +
"\t<li>HTML List Item 2</li>\n" +
"\t<li>HTML List Item 3</li>\n" +
cp /xyz_path\ 1.z01 ~/temp/xyz\ 1.z01
cp /xyz_path\ 1.zip ~/temp/xyz\ 1.zip
zip -FF xyz\ 1.zip --out xyz\ 1.zip.fixed
mkdir xyz\ 3
unzip -d xyz\ 3/ xyz\ 1.zip.fixed
du --total xyz\ 3
>> 10466048 (~10.5 GB => success)
zip -FF should be applied to last part of archive, it will automatically check for all parts