-
-
Save holm-xie/2b0f597e6b48d2d305431dad3a89571a to your computer and use it in GitHub Desktop.
Run clear GNURoot Debian, download android_jupyter_install.sh and run command: sh android_jupyter_install.sh
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
#!/bin/bash | |
# Update | |
apt-get update && apt-get upgrade -y | |
# Install python+packages and curl | |
apt-get install -y python3 python3-pip python3-numpy python3-scipy python3-matplotlib ipython3 ipython3-notebook python3-pandas python3-nose curl wget | |
# Update pip | |
python3 -m easy_install -U pip | |
# Correctinng python file | |
# which causes stuck during package installation | |
cd / | |
curl https://gist.githubusercontent.com/Breta01/acdf05e37efcebdab05dbd95ce14394a/raw/linklockfile.py > /usr/local/lib/python3.4/dist-packages/pip-9.0.1-py3.4.egg/pip/_vendor/lockfile/linklockfile.py | |
# Get requirements file | |
cd ~ | |
curl -O https://gist.githubusercontent.com/Breta01/acdf05e37efcebdab05dbd95ce14394a/raw/requirements.txt | |
# Install pip packages | |
cat requirements.txt | while read PACKAGE; do pip install --no-deps "$PACKAGE"; done | |
# Cleaning | |
rm requirements.txt |
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 __future__ import absolute_import | |
import time | |
import os | |
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, | |
AlreadyLocked) | |
class LinkLockFile(LockBase): | |
"""Lock access to a file using atomic property of link(2). | |
>>> lock = LinkLockFile('somefile') | |
>>> lock = LinkLockFile('somefile', threaded=False) | |
""" | |
def acquire(self, timeout=None): | |
try: | |
open(self.unique_name, "wb").close() | |
except IOError: | |
raise LockFailed("failed to create %s" % self.unique_name) | |
timeout = timeout if timeout is not None else self.timeout | |
end_time = time.time() | |
if timeout is not None and timeout > 0: | |
end_time += timeout | |
while True: | |
# Try and create a hard link to it. | |
try: | |
# This causes the stact after package install | |
# You can uncomment the line below after install | |
# and delete print() | |
# os.link(self.unique_name, self.lock_file) | |
print("Skipping hard link creation") | |
except OSError: | |
# Link creation failed. Maybe we've double-locked? | |
nlinks = os.stat(self.unique_name).st_nlink | |
if nlinks == 2: | |
# The original link plus the one I created == 2. We're | |
# good to go. | |
return | |
else: | |
# Otherwise the lock creation failed. | |
if timeout is not None and time.time() > end_time: | |
os.unlink(self.unique_name) | |
if timeout > 0: | |
raise LockTimeout("Timeout waiting to acquire" | |
" lock for %s" % | |
self.path) | |
else: | |
raise AlreadyLocked("%s is already locked" % | |
self.path) | |
time.sleep(timeout is not None and timeout / 10 or 0.1) | |
else: | |
# Link creation succeeded. We're good to go. | |
return | |
def release(self): | |
if not self.is_locked(): | |
raise NotLocked("%s is not locked" % self.path) | |
elif not os.path.exists(self.unique_name): | |
raise NotMyLock("%s is locked, but not by me" % self.path) | |
os.unlink(self.unique_name) | |
os.unlink(self.lock_file) | |
def is_locked(self): | |
return os.path.exists(self.lock_file) | |
def i_am_locking(self): | |
return (self.is_locked() and | |
os.path.exists(self.unique_name) and | |
os.stat(self.unique_name).st_nlink == 2) | |
def break_lock(self): | |
if os.path.exists(self.lock_file): | |
os.unlink(self.lock_file) |
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
appdirs==1.4.2 | |
backports-abc==0.5 | |
beautifulsoup4==4.3.2 | |
bleach==1.5.0 | |
chardet==2.3.0 | |
colorama==0.3.2 | |
decorator==4.0.11 | |
entrypoints==0.2.2 | |
html5lib==0.999 | |
ipykernel==4.5.2 | |
ipython==5.3.0 | |
ipython-genutils==0.1.0 | |
ipywidgets==5.2.2 | |
Jinja2==2.9.5 | |
jsonschema==2.6.0 | |
jupyter==1.0.0 | |
jupyter-client==5.0.0 | |
jupyter-console==5.1.0 | |
jupyter-core==4.3.0 | |
lxml==3.4.0 | |
MarkupSafe==0.23 | |
matplotlib==1.4.2 | |
mistune==0.7.3 | |
mpmath==0.19 | |
nbconvert==5.1.1 | |
nbformat==4.3.0 | |
nose==1.3.4 | |
notebook==4.4.1 | |
numexpr==2.4 | |
numpy==1.12.0 | |
packaging==16.8 | |
pandas==0.14.1 | |
pandocfilters==1.4.1 | |
pexpect==4.2.1 | |
pickleshare==0.7.4 | |
Pillow==2.6.1 | |
prompt-toolkit==1.0.13 | |
ptyprocess==0.5.1 | |
Pygments==2.2.0 | |
pyparsing==2.1.10 | |
python-dateutil==2.6.0 | |
pytz==2012rc0 | |
pyzmq==16.0.2 | |
qtconsole==4.2.1 | |
requests==2.4.3 | |
scipy==0.14.0 | |
simplegeneric==0.8.1 | |
six==1.8.0 | |
sympy==1.0 | |
tables==3.1.1 | |
terminado==0.6 | |
testpath==0.3 | |
tornado==4.4.2 | |
traitlets==4.3.2 | |
urllib3==1.9.1 | |
wcwidth==0.1.7 | |
widgetsnbextension==1.2.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment