Monday, July 1, 2019

Install Python3.7 on Windows Subsystem for Linux (WSL)

​1. Install the python3.7 package using apt-get
sudo apt-get install python3.7

2. Add python3.6 & python3.7 to update-alternatives

​sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

3. Update python3 to point to python3.7
sudo update-alternatives --config python3

4. Test the version of python
python3 -v

5. Solve Error
sudo apt-get remove python3-apt -y

Error Permission Pipenv on /home/$USER/.cache in WLS

add $USER to root group

change Permission /home/$USER/.cache to 775

How to change default WSL mount Point

​create /etc/wsl.conf file

[automount]
root = /
options = "metadata"

reboot WSL Services

How to restart Windows Subsystem for Linux (WSL)

​open services.msc

LxssManager -> restart

Setup Docker in Windows Subsystem for Linux (WSL)

​Docker Setup:

Download Docker for Windows​

​docker -> settings -> general -> "expose deamon on tcp://localhost:2375 without TLS"

On WSL:

$sudo apt update -y
$sudo apt upgrade -y

$sudo apt install docker.io
$sudo usermod -aG docker $USER

Add PATH:

check:
echo $PATH | grep /home/$USER

if not exist
add path:

vi  ~/.profile

export PATH="$PATH:$HOME/.local/bin"

​Setup Docker in WSL

$echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc

Docker 101

Build images:
​docker built -t tag/name .

List Images:
docker images

Check Process RUN:
docker ps

Check Process ALL:
docker ps -a

Docker run Daemon Mode :
docker run -d -p 80:5000 images/name

Docker run and delete when Stop Container:
docker run --rm -d -p 80:5000 images/name (daemon mode)
docker run --rm -it -p 80:5000 images/name (run and show terminal)

Connect to Container
docker exec -it docker_instance_id shell_in_container

Docker Save Images:
​docker save images_name > images_name.tar
docker save -o images_name.tar images_name


Docker Load Images:
docker load < test_save.tar
docker load -i test_save.tar

Docker Copy :
docker cp filename container_id:/path_to_file/file
docker cp container_id:/path_to_file/file src_file/file
​​On Python FLASK

Dockerfile Example:
​from python
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
ENV FLASK_APP=app.py
ENV FLASK_DEBUG=1
CMD flask run --host=0.0.0.0

Monday, January 7, 2019

How to Connect SharePoint Online via PowerShell

Check Module:

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version

Install Module:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

Connect SPO Script

$adminUPN="username@domain.name"
$orgName="nida365"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout