Skip to content

Instantly share code, notes, and snippets.

Muthukrishnan muthuspark

Block or report user

Report or block muthuspark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@muthuspark
muthuspark / Get APK of playstore app through abd
Created Sep 18, 2019
series of steps to get the apk from the phone in usb debugging mode.
View Get APK of playstore app through abd
The sequence of steps lets me download an APK of any app I have downloaded from the playstore.
1. install the app from playstore in the app or emulator. example instagram
2. get the name of the package of the app I am interested in, this can also be taken from the playstore URL,
``adb shell pm list packages | grep instagram``
3. get the location of the apk in the phone
``adb shell pm path com.instagram.android``
4. download the app to the local system
``adb pull /data/app/com.instagram.android-XJc0EbhiBn-d0G4UmdnmgQ==/base.apk``
@muthuspark
muthuspark / gist:442bd75f3dae4e73c8b2bbe0edba48d8
Created Jun 26, 2019
convert a dictionary to array in python
View gist:442bd75f3dae4e73c8b2bbe0edba48d8
# A list of the keys of dictionary
list_keys = [ k for k in dict ]
# or a list of the values
list_values = [ v for v in dict.values() ]
# or just a list of the list of key value pairs
list_key_value = [ [k,v] for k, v in dict.items() ]
@muthuspark
muthuspark / gist:25ebe61b11617f86668655326ea3a82d
Created May 10, 2019
run length smoothing algorithm - on binary image
View gist:25ebe61b11617f86668655326ea3a82d
X = [0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1]
def run_length_smoothing(X, run_length_width):
block = []
for index, intensity in enumerate(X):
if intensity == 1 and len(block) <= run_length_width:
for j in block:
X[j] = 1
@muthuspark
muthuspark / gist:d1c0d567ac295a796b011a5d0fb33b4c
Created May 10, 2019
upload image from local file - python request
View gist:d1c0d567ac295a796b011a5d0fb33b4c
import os
import requests
img_to_upload = '/Users/muthukrishnan/Pictures/15566790261881556159500299IMG_20190330_120119.jpg'
url = "http://localhost:5000/api/document/page-extract"
uploaded_img_path = ''
with open(img_to_upload, 'rb') as img:
name_img = os.path.basename(img_to_upload)
View Simple K-Means from scratch using Python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.datasets.samples_generator import make_blobs
class K_Means:
def __init__(self, k=3, max_iterations = 500):
self.k = k
@muthuspark
muthuspark / gist:f43b08251cd0ec813dfd75823a644fff
Created Feb 27, 2018
List all the files in AWS bucket nodejs
View gist:f43b08251cd0ec813dfd75823a644fff
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: "ACCESS_KEY",
secretAccessKey: "SECRET_ACCESS_KEY"
});
// Create an S3 client
var s3 = new AWS.S3();
@muthuspark
muthuspark / gist:5949e24fe19feb0c363677385185538a
Created Sep 1, 2017
Node JS based code to upload folders into AWS S3 using aws-sdk
View gist:5949e24fe19feb0c363677385185538a
var q = require('q');
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: "131231",
secretAccessKey: "23135124"
});
// Create an S3 client
var s3 = new AWS.S3();
@muthuspark
muthuspark / gist:a2be62f9c1ee63202bd708a9ccbb383f
Last active Jul 25, 2017
Using node.js as a simple web server
View gist:a2be62f9c1ee63202bd708a9ccbb383f
Install connect and serve-static with NPM
$ npm install connect serve-static
Create server.js file with this content:
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080, function(){
console.log('Server running on 8080...');
@muthuspark
muthuspark / restify
Last active Mar 23, 2017
Basic Rest using Restify
View restify
var restify = require('restify');
var server = restify.createServer();
server.use(restify.bodyParser());
function corsHandler(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'Origin, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Response-Time, X-PINGOTHER, X-CSRF-Token,Authorization');
res.setHeader('Access-Control-Allow-Methods', '*');
res.setHeader('Access-Control-Expose-Headers', 'X-Api-Version, X-Request-Id, X-Response-Time');
View get url parameters
if (window.location.search) {
var qs = window.location.search.split('+').join(' ');
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}
You can’t perform that action at this time.