Skip to content

Instantly share code, notes, and snippets.

View sajjadintel's full-sized avatar

Sajad Abbasi sajjadintel

View GitHub Profile
test
@sajjadintel
sajjadintel / GetCpuTempAndroid.java
Created December 4, 2017 17:52
Get the CPU temperature from an android device by using the sys/class/thermal/temp command.
public float getCpuTemp() {
Process process;
try {
process = Runtime.getRuntime().exec("cat sys/class/thermal/thermal_zone0/temp");
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = reader.readLine();
float temp = Float.parseFloat(line) / 1000.0f;
return temp;
} catch (Exception e) {
@sajjadintel
sajjadintel / spotify hosts for remove ads
Created March 31, 2018 18:07
spotify hosts for remove ads
############## SPOTIFY - ADS - BEGIN
127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 securepubads.g.doubleclick.net
127.0.0.1 www.omaze.com
@sajjadintel
sajjadintel / 0.README.md
Created June 9, 2018 13:16 — forked from agentcooper/0.README.md
Telegram chat backup/export

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation

@sajjadintel
sajjadintel / mysql_backup.sh
Created June 12, 2018 12:33 — forked from tleish/mysql_backup.sh
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am
@sajjadintel
sajjadintel / EachDirectoryPath.md
Created April 2, 2019 11:03 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@sajjadintel
sajjadintel / DatabaseSeeder.php
Created August 13, 2019 07:30 — forked from bgallagh3r/DatabaseSeeder.php
Disable Foreign Key Constraints when Seeding DB with Artisan Migrate/DB Seed This prevents SQL from throwing errors when you try to do DB::table()->truncate() as TRUNCATE is disallowed when FK constraints are in place.
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
@sajjadintel
sajjadintel / guide.md
Created December 24, 2019 18:00 — forked from mindlapse/guide.md
A guide on how to use PaymentIntents with tipsi-stripe

Introduction

Card payments with Stripe should be performed with PaymentIntents.

This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.

Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication

@sajjadintel
sajjadintel / OAuthClient.java
Created July 10, 2020 08:22 — forked from dzolnai/OAuthClient.java
Retrofit OAuth2 refreshing tokens without modifying all requests.
package com.example.yourapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.example.yourapp.AuthenticationModel;
import retrofit.client.Header;
import retrofit.client.OkClient;
@sajjadintel
sajjadintel / Burp certificate on Android
Created January 27, 2021 19:00 — forked from PaulSec/Burp certificate on Android
Add your Burp certificate on an Android device
To do so:
1. Export your Burp Certificate
Proxy > Options > CA Certificate > Export in DER format
2. Convert it to PEM
openssl x509 -inform der -in cacert.der -out burp.pem
3. Download it on the device