This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zipfile import ZipFile | |
from plistlib import loads | |
archive = ZipFile('Kodi19Alpha64bit.ipa') | |
plist_file = archive.read('Payload/Kodi.app/Info.plist') | |
pl = loads(plist_file) | |
pl['CFBundleDisplayName'] #output: 'Kodi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copying folders | |
self.output_dir = output_dir | |
if output_dir is not None: | |
if not os.path.isdir(output_dir): | |
os.makedirs(output_dir) | |
html_index_path = pkg_resources.resource_filename("droidbot", "resources/index.html") | |
stylesheets_path = pkg_resources.resource_filename("droidbot", "resources/stylesheets") | |
images_path = pkg_resources.resource_filename("droidbot", "resources/images") | |
target_stylesheets_dir = os.path.join(output_dir, "stylesheets") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
class ThreadingExample(object): | |
""" Threading example class | |
The run() method will be started and it will run in the background | |
until the application exits. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import email | |
import imaplib | |
import mailbox | |
EMAIL_ACCOUNT = "your@gmail.com" | |
PASSWORD = "your password" | |
mail = imaplib.IMAP4_SSL('imap.gmail.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Categorical boolean mask | |
categorical_feature_mask = X.dtypes==object | |
# filter categorical columns using mask and turn it into a list | |
categorical_cols = X.columns[categorical_feature_mask].tolist() | |
# import labelencoder | |
from sklearn.preprocessing import LabelEncoder | |
# instantiate labelencoder object | |
le = LabelEncoder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
This is a small demo file that helps teach how to adjust figure sizes | |
for matplotlib | |
""" | |
import matplotlib | |
print "using MPL version:", matplotlib.__version__ | |
matplotlib.use("WXAgg") # do this before pylab so you don'tget the default back end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!pip install -U --no-deps mapclassify git+git://github.com/geopandas/geopandas.git@master | |
!pip install pysal==2 | |
!pip install fiona | |
!pip install pyproj | |
%matplotlib inline | |
import geopandas as gpd | |
import matplotlib as mpl # make rcParams available (optional) | |
mpl.rcParams['figure.dpi']= 144 # increase dpi (optional) | |
world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pairs = set( [(0,1),(0,1),(1,0),(1,2),(1,0),(2,1)] ) | |
set((a,b) if a<=b else (b,a) for a,b in pairs) | |
or | |
pairs = set(frozenset(p) for p in ((0,1),(0,1),(1,0)) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask, request, redirect, url_for,send_from_directory | |
from werkzeug import secure_filename | |
UPLOAD_FOLDER = 'uploads/' | |
ALLOWED_EXTENSIONS = set(['ipa']) | |
app = Flask(__name__) | |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def tracefunc(frame, event, arg, indent=[0]): | |
if event == "call": | |
indent[0] += 2 | |
print("-" * indent[0] + "> call function", frame.f_code.co_name) | |
elif event == "return": | |
print("<" + "-" * indent[0], "exit function", frame.f_code.co_name) | |
indent[0] -= 2 | |
return tracefunc | |
NewerOlder