Skip to content

Instantly share code, notes, and snippets.

View shriduttkothari's full-sized avatar
🎯
Focusing

Shridutt Kothari shriduttkothari

🎯
Focusing
View GitHub Profile
@shriduttkothari
shriduttkothari / integrate-opengapps.sh
Created October 4, 2016 14:28
opengapps integration script for android-x86
#!/bin/bash
prog=$(basename $0)
if [ ! -f build/envsetup.sh ]; then
echo ${prog}: Please cd to the directory you ran \'repo init\' in.
exit 1
fi
source build/envsetup.sh
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
#!/bin/sh -e
#
# Save this file as ~/bin/git-submit
#
# Usage: git submit [--draft] [remote]
# Example:
# 'git submit' executed on a Git branch tracking origin/master will push to refs/for/master.
#
REMOTE=origin
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
@shriduttkothari
shriduttkothari / recovery.cpp
Created August 22, 2013 14:29
Typical RC commands which may be supplied in the /cache/recovery/command file:
/*
* --send_intent=anystring - write the text out to recovery.intent
* --update_package=path - verify install an OTA package file
* --wipe_data - erase user data (and cache), then reboot
* --wipe_cache - wipe cache (but not user data), then reboot
* --set_encrypted_filesystem=on|off - enables / diasables encrypted fs
* --just_exit - do nothing; exit
*/
@shriduttkothari
shriduttkothari / ota_from_target_files.py
Last active December 21, 2015 12:39
If the new update package is having older “build date time” than we should comment the following line from file: /build/tools/releasetools/ota_from_target_files As the mentioned line creates the assert in the updater script for older build and aborts the installation if the update file is having older “build date time”.
def WriteFullOTAPackage(input_zip, output_zip):
# comment the following line:
script.AssertOlderBuild(ts);
@shriduttkothari
shriduttkothari / Verify&Install.java
Created August 22, 2013 13:39
On successful download of the update zip file from server we must verify the cryptographic signature of the downloaded update file, and then we can install it as follows: It will reboot the device in recovery mode, where recovery console will first verify the signature of the file then execute the updater script of that update zip file, which wi…
try {
File otafileloc = new File("/cache/update.zip");
// Verify the cryptographic signature before installing it.
RecoverySystem.verifyPackage(otafileloc, null, null);
// Reboots the device into recovery mode to install the update package.
RecoverySystem.installPackage(getApplicationContext(), otafileloc);
} catch (IOException e) {
e.printStackTrace();
} catch (GeneralSecurityException e) {
e.printStackTrace();
@shriduttkothari
shriduttkothari / DownloaderAsyncTask.java
Created August 22, 2013 13:22
On a valid RomInfo Object received, Start the Downloader AsyncTask to download the update zip file from server, the doInBackground() method will have pseudo code as follows:
private int doInBackground(Void... notused) {
final File dest = new File("/cache/update.zip");
InputStream is = null;
OutputStream os = null;
try {
URL getUrl = new URL(romInfo.url);
destFile.getAbsolutePath());
URLConnection conn = getUrl.openConnection();
conn.connect();
is = new BufferedInputStream(conn.getInputStream());
@shriduttkothari
shriduttkothari / AndroidMenifest.xml
Created August 22, 2013 13:04
Create a broadcast receiver with intent filter "android.intent.action.BOOT_COMPLETED" So that when device boots up we can start our UpdateCheckReceiver class, which can Schedule a repeating alarm to send the pending intent to this same broadcastReceiver class to instantiate a new AsyncTask, to perform polling on server, to check the update.
<receiver android:name="com.example.UpdateCheckReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
@shriduttkothari
shriduttkothari / RomCheckerAyncTask.java
Last active December 21, 2015 12:38
Create an AsyncTask, which can be called whenever polling is required to be performed to check the update on server, the doInBackground() method will have pseudo code as follows:
private RomInfo doInBackground(Void... notused) {
//Check Network availability
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("device",android.os.Build.DEVICE.toLowerCase()));
params.add(new BasicNameValuePair("rom", Utils.getRomID()));
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(SERVER_PULL_URL + "?" + URLEncodedUtils.format(params, "UTF-8"));
HttpResponse r = client.execute(get);
int status = r.getStatusLine().getStatusCode();