Using Python Virtual Environments

Refer: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

Install on Ubuntu 18.04

sudo apt-get install python3-venv

Create a virtual environment

python3 -m venv env

Activating a virtual environment

source env/bin/activate

Confirm you are pointing to your virtual environment

which python

You should seem something like

.../env/bin/python

Leaving the virtual environment

deactivate

Installing packages, when inside virtual environment

python3 -m pip install requests

Installing specific versions

python3 -m pip install requests==2.18.4

Upgrading packages

pip can upgrade packages in-place using the --upgrade flag. For example, to install the latest version of requests and all of its dependencies:

python3 -m pip install --upgrade requests

Using requirements files

Instead of installing packages individually, pip allows you to declare all dependencies in a Requirements File. For example you could create a requirements.txt file containing:

requests==2.18.4
google-auth==1.1.0

Tell pip to install all the packages in this file using the -r flag:

python3 -m pip install -r requirements.txt

Freezing dependencies

Pip can export a list of all installed packages and their versions using the freeze command:

python3 -m pip freeze

Which will output a list of package specifiers such as:

cachetools==2.0.1
certifi==2017.7.27.1
chardet==3.0.4
google-auth==1.1.1
idna==2.6
pyasn1==0.3.6
pyasn1-modules==0.1.4
requests==2.18.4
rsa==3.4.2
six==1.11.0
urllib3==1.22

This is useful for creating Requirements Files that can re-create the exact versions of all packages installed in an environment.

Fix Docker DNS Cache behind VPN

It seems like Docker is caching the host's /etc/resolv.conf as it was when docker started up. So I restarted Docker after connecting to the VPN and now containers are able to resolve hosts that are in m company's DNS.

If you are developing on Ubuntu, you will need to use "--net=host" to work behind the VPN, such as this:

docker run --rm \
  -v ${PWD}:/home \
  -it \
  --net=host \
  mruckman/selenium_python:212301 /bin/bash

SSH Fails to Connect

Symptom

sign_and_send_pubkey: signing failed for RSA

Solution, make sure your ~/.ssh/id_rsa has the proper permissions, it should be read/write for the owner and none for anyone else.

Mac Chrome Fresh

Create a bash file, something like "chrome-fresh.sh" with the following, it will randomize a file for a new user profile in your temp folder

#!/bin/bash
tfile=$(mktemp /tmp/chrome.XXXXXXXXX)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/$tfile

Or Launch a Single browser, delete the temp folder when you want a fresh one.

cd /tmp
rm -rf james_bonds_browser
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/james_bonds_browser"

If you launch a chrome fresh grab yourself some plug-ins if you need them.

Akamai Headers

Install Akamai Headers Extension

Script Blocker Ultimate

Install Script Blocker Extension

Add these to Request Blocker in Script Blocker Ultimate

Adobe DTM Scripts

*://assets.adobedtm.com/*
*://carnivalbrands.tt.omtrdc.net/*

Tracking Scripts

*://col.eum-appdynamics.com/*
*://ad.doubleclick.net/*
*://r.turn.com/*
*://insight.adsrvr.org/*
*://5955407.fls.doubleclick.net/*
*://p11.techlab-cdn.com/*
*://173e2529.akstat.io/*
*://cdn.mouseflow.com/*
*://n2.mouseflow.com/*

If you just want to use the built-in script blocker for chrome without a plug-in

assets.adobedtm.com
carnivalbrands.tt.omtrdc.net
col.eum-appdynamics.com
ad.doubleclick.net
r.turn.com
insight.adsrvr.org
5955407.fls.doubleclick.net
p11.techlab-cdn.com
173e2529.akstat.io

MD5SUM – Checksum on Linux

Use the following command to get a checksum

md5sum html/path/file.php

Create a file of checksums for future verification, here's just one file create a batch job to create lots of files instead.

md5sum html/path/file.php > md5sum_input.txt

Now check the md5 keys again, using md5sum_input.txt

md5sum -c md5sum_input.txt

Opt Out Advertising

Refer: https://www.pushspring.com/optout.html

T-Mobile has hidden the. DO NOT SELL Link and you have to opt-in to DO NOT SELL.

Use this link: https://www.t-mobile.com/dns?brand=Magenta&site=Sell_App&origin_url=www.t-mobile.com%2Fprivacy-center#

PushSpring develops and utilizes technology that allows for collection of personally identifiable information associated to end user devices via pseudonymous, resettable device advertising IDs on devices that support advertising IDs, to create aggregated interest and behavior-based targeting segments, to drive targeted advertising campaigns, and to perform analytics services for our customers.