Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Aditya Srivastava IamAdiSri

🎯
Focusing
View GitHub Profile
@IamAdiSri
IamAdiSri / Microsoft.PowerShell_profile.ps1
Created Jun 3, 2019
Windows PowerShell Profile Snippets
View Microsoft.PowerShell_profile.ps1
# Loads the Visual Studio Developer Command Prompt environment into Powershell
$installationPath = "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
set-content env:\"$name" $value
}
}
echo "> Visual Studio Developer Command Prompt loaded onto environment."
@IamAdiSri
IamAdiSri / jp.sh
Last active Apr 5, 2019
Remote Jupyter Notebook - Server to Client Reverse Tunneling Script
View jp.sh
#!/bin/bash
if [ $# -lt 2 ] ; then
echo "jp.sh <port on server> <port n local>"
echo "example: sh jp.sh 8686 8989"
echo "jp.sh <port on server> <port on local> <local ip> <user name>"
echo "example: sh jp.sh 8686 8989 10.x.x.x username"
exit 1
fi
@IamAdiSri
IamAdiSri / Windows SSH Setup.md
Created Jan 3, 2019
Setup Windows to accept SSH connections and Tunneling
View Windows SSH Setup.md

Windows SSH Setup

The steps to enable both SSH and tunneling/port forwarding are as follows:

  1. Open Settings > Update and Security > For Developers.
  2. Click on the radio button for Developer mode; this will open up your system's port 22 and allow the SSH broker to start listening for incoming connections.
  3. If you just switched to Developer mode, restart your computer, and then follow step 1 again.
  4. Under Device discovery turn on the option labeled Make your device visible to USB connections and your local network.
  5. Under Device discovery turn on the option labeled User OpenSSH (Beta) server for remote deployment.
@IamAdiSri
IamAdiSri / pickler.py
Last active Jul 15, 2020
Pickling objects in Python3
View pickler.py
class Pickler():
"""
Conveniently pickle Python objects and load pickled objects.
"""
def save(self, obj, loc):
"""
INPUT:
obj = Python object to be pickled.
loc = Location where pickled object will be saved.
OUTPUT:
@IamAdiSri
IamAdiSri / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Last active Jul 20, 2020 — forked from evansneath/Python3 Virtualenv Setup
Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
View Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
You can’t perform that action at this time.