Steps:
The color profile of your terminal is stored in .barsh_profile
in your home directory. Lets edit that in your terminal:
$ cd ~
$ nano .bash_profile
or if you have sublime text installed using homebrew
then:
## just a file to try out command line parsing | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('url', help="Enter portal url of the form: \ | |
https://portalname.domain.com/webadaptor") | |
#Create optional args by prefixing it with -- | |
#Create short names for same by prefixing it with - | |
#Specify default values using 'default' argument |
import os | |
data_root = r'root dir to walk down' | |
for directory, subdir_list, file_list in os.walk(data_root): | |
print(directory) | |
print("\t", end="") | |
print(subdir_list) | |
print("\t\t", end="") | |
print(file_list) | |
=============================================================== |
I prefer installing app managers and getting apps from them. For instance, it is a lot easier to install apps from
Mac App store, however, not all apps are distributed that way. Hence, get brew
and cask
for brew. brew
is a
Homebrew project which gives a CLI for installing and updating apps. In no time, you can update and manage apps like you
manage Python
or Java
packages using conda
or maven
.
Get brew by pasting
# Hacky script for downloading videos from PyVideo and converting them to m4v | |
# format so they can be synced onto your apple device. Useful if you | |
# want to see everything that happened at PyCon while commuting. | |
# | |
# Requirements: | |
# * pip install requests BeautifulSoup | |
# * youtube-dl (from https://github.com/rg3/youtube-dl/) - add this to the | |
# directory where this script runs and ensure its execute bit is set. | |
# This was the only YouTube downloader I found that worked. It doesn't | |
# really have a good Python API so I call it through os.system. |
import ftplib | |
# connect to the server | |
ftp = ftplib.FTP('ftp.ncdc.noaa.gov') #pass the url without protocol | |
ftp.login() #pass credentials if anonymous access is not allowed | |
# switch to the directory containing the data | |
ftp.cwd('/pub/data/swdi/database-csv/v2/') | |
ftp.pwd() |
# simple python script to walk a module and print publicly accessible identifiers | |
#Import your library | |
from arcgis.gis import GIS | |
import inspect | |
#instantiate your root object | |
gis = GIS() | |
#build up a list of primitive/builtin types to ignore. You can add your custom types as well. |
import requests | |
from pathlib import Path | |
import multiprocessing | |
#read the download file | |
with open('./download_links.txt','r') as fhandle: | |
files = fhandle.readlines() | |
def downloader(url): | |
img_name = Path(url).name.rstrip('\n') |
#flatten a list of list | |
extent = [[-84.28620418884404, 33.98540048952816], [-84.09769613557806, 34.090609514767856]] | |
flat_list = [element for sublist in extent for element in sublist] | |
# [-84.28620418884404, 33.98540048952816, -84.09769613557806, 34.090609514767856] | |
#stringify a list of numbers | |
stringified_flat_list = ','.join(str(e) for e in flat_list) | |
# '-84.28620418884404,33.98540048952816,-84.09769613557806,34.090609514767856' |
git remote add <name> <url.git>
This adds the forked repo as a remote. You don't need this if you have merge privileges.
You can then fetch
and checkout
the branch of your choice
git fetch <name or remote>
git checkout # allow tab completion to help you here.