Skip to content

Instantly share code, notes, and snippets.

@bharath2020
bharath2020 / Download 'data' from Android without roooting
Last active January 25, 2024 21:13
Download manifest from Android APK
//download data.ab (encrypted) and DONOT GIVE ANY PASSWORD when prompted
adb backup -f ~/data.ab -noapk app.package.name
//decrypt and extract the data.ab [this worked most of the time except for few instances ]
//this will output all the contents of app into 'apps' directory
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
//SOURCE: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
@M-Medhat
M-Medhat / RegExReplace.swift
Created February 2, 2015 09:33
Regular Expressions: How to replace patterns in Swift
// You need to import Foundation to use NSRegularExpression, NSError and NSString
import Foundation
/// This function takes three parameters
/// text: a string that we search in
/// pattern: a reqular expression pattern to use in the search
/// withTemplate: the string that we use instead of the occurrances we find in text
///
/// The method returns (text) with occurrance found using (pattern) replaced with (withTemplate)
func regexReplace(text:String, pattern:String, withTemplate:String) -> String {
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
@marty-wang
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active February 13, 2024 07:34
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

1. Store api keys in a xml file

Put xml file "api_keys.xml" in the directory "res/value/".

api_keys.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="THE_MOVIE_DB_API_TOKEN">XXXXX</string>
</resources>
yes you can
AppBarLayout appBar;
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if(verticalOffset > -300) {
collapsedAppBar.setTitleEnabled(false);
}
else {
@danielmai
danielmai / ForecastListToDetailTest.java
Created December 18, 2015 23:22
Espresso test for Sunshine. Demo for the Android Testing webcast in the Android Developer Nanodegree.
package com.example.android.sunshine.app.ui;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import com.example.android.sunshine.app.MainActivity;
import com.example.android.sunshine.app.R;
import org.junit.Rule;
@JIghtuse
JIghtuse / echo_server.cxx
Last active July 23, 2023 09:06
echo server (select, C++)
#include <array>
#include <cassert>
#include <iostream>
#include <set>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
package ru.mobileup.grushasdk.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
/**
* @author Vasili Chyrvon (vasili.chyrvon@gmail.com)
@geniushkg
geniushkg / filter category in result retrofit list
Created September 27, 2016 05:03
sample gist to filter content from retrofit response
// this is retrofit response
Eventlist eventlist = response.body();
List<Website> websites = eventlist.getWebsites(); // website is POJO class for even as per api
List<Website> filteredWebsite = new ArrayList<Website>(); // empty list new
for(Website temp:websites){
if(temp.getCategory().equalsIgnoreCase(sortType.name())){
filteredWebsite.add(temp); // sortType.name() is BOT or Competitive or whichever selected
}
}