Skip to content

Instantly share code, notes, and snippets.

import logging.config
import coloredlogs
logging.config.dictConfig(
{
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
@ndvo2710
ndvo2710 / installApk
Last active September 20, 2018 22:43
Install Multiple APKs on multiple Android
import sys, os
import time
import shutil, zipfile
import subprocess, shlex
import argparse
import StringIO
HOME = os.getcwd()
def getAllDeviceIds():
@ndvo2710
ndvo2710 / 1) Introduction
Last active April 4, 2018 01:16
2) Optimizing Postgres Databases
A) Exploring Postgres Internal
B) Debugging Postgres Queries
C) Using an Index
D) Advanced Indexing
E) Vacuuming Postgres Databases
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
# Grab stdout line by line as it becomes available. This will loop until
# p terminates.
while p.poll() is None:
l = p.stdout.readline() # This blocks until it receives a newline.
print l
# When the subprocess terminates there might be unconsumed output
# that still needs to be processed.
print p.stdout.read()
@ndvo2710
ndvo2710 / import argparse
Created March 15, 2018 08:40
py:: argparse
parser = argparse.ArgumentParser()
parser.add_argument('build',
type=str,
help='GET WORKING INPUT NUMBER')
parser.add_argument('-d', '--download',
action='store_true',
help='DOWNLOAD BUILD')
parser.add_argument('-f', '--flash',
action='store_true',
help='FLASH BUILD')
@ndvo2710
ndvo2710 / MoveZipnExtract
Created March 15, 2018 08:35
py: File, Folder, Directory snippets
for elem in os.listdir(DOWNLOAD_DIR):
if elem.endswith('.zip'):
src = os.path.join(DOWNLOAD_DIR, elem)
dst = os.path.join(........)
shutil.move(src, dst)
time.sleep(20)
zipPath = os.path.join(dst, elem)
zip_ref = zipfile.ZipFile(zipPath, 'r')
@ndvo2710
ndvo2710 / IdleDrainTest.py
Last active March 20, 2018 08:35
Power Drain Test
import os
import sys
import time
import subprocess
import shlex
import re
def read_battery_level(device):
cmd = "adb -s " + device + " shell dumpsys battery| grep level"
@ndvo2710
ndvo2710 / app.py
Created March 15, 2018 08:09
Plotly-Dash
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
@ndvo2710
ndvo2710 / index.html
Created April 29, 2017 02:21
Two Bell Curves
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Two Bell Curves</title>
<meta name="description" content="">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style type="text/css">
@ndvo2710
ndvo2710 / data.csv
Last active April 29, 2017 02:17
TOP 10 GOOGLE SALARIES 2012
Rank Job channel Salary
1 1 Lead Software Engineer Contractor Low 221000
2 2 Product Management Director Low 203000
3 3 Directors Low 172000
4 4 Engineering Director Low 184000
5 5 Human Resources Director Low 183000
6 6 Senior Partner Technology Manager Low 180000
7 7 Staff User Experience Designer Low 167000
8 8 Marketing Director Low 165000
9 9 Group Product Manager Low 157000