Skip to content

Coding

Python3 create and active a python virtual environment

Intro to Python3 environments

While using Python, you might want to use a separate environment to keep pip packages separate from other environments
or separate from your main operation system.

Python virtual environments is on of the options for that.
Of course you could use containers but here I just want a quick and simple virtual environment to run python code.

Official page and documentation https://docs.python.org/3/library/venv.html

Python 3 creating a virtual environment

python3 -m venv /path/to/new/virtual/environment

-m use for python module venv virtual environment module /path/to/new/virtual/environment folder/directory for the virtual environment


Python 3 activating a virtual environment

source <venv>/bin/activate


Happy learning!

Antonio Feijao UK

practice-python-3-with-the-fibonacci-sequence

Learn Python with a simple "do it yourself" challenges. I went to bed thinking "how could I do the Fibonacci sequence without looking on the internet. Next day, getting python skills into practice, I came up with the below basic python code:

In mathematics, the Fibonacci numbers form a sequence called the Fibonacci sequence. Each number is the sum of the two preceding ones, starting from 0 and 1.

Thought I would share this challenge in case there is someone out there looking to practice Python 3 as weel. This is a simple and fun challenge. Try not to copy this code, create your own version, start simple, maybe just add numbers, then add the conditions while loop.

python fibonacci sequence

No matter how we present these numbers, it always seems to be impressive. Maybe that is why they are also known as the "gold ratio".

Learn more about the Fibonacci numbers and sequence in this wikipedia page.

Let me know if this was useful.


Happy learning

Antonio Feijao UK

github-basics-command

Github git basic commands

Some basic git command and working with ssh keys to update the repository

https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

git clone


ssh-keygen -t rsa -b 4096 -C "my comment "

vim ~/.ssh/config

eval "$(ssh-agent -s)"

ssh-add "my-private-key..."


git remote set-url origin [email protected]:"USERNAME"/"REPOSITORI.git"


git status

git add .

git commit -am "message/comment about changes"

git push

git pull

git with ssh key

  1. first create your ssh key ssh-keygen -b 4096
  2. add the .pub key into your repository
  3. check this setup - https://medium.com/@czarpino/how-to-tell-git-which-ssh-key-to-use-c8574fb243fd

Good documentation about git commands

vim and vimrc file options

vimrc file options

vimrc file options

  • Remember, if you are using a colorscheme, you need to download that scheme. Example, check the link for the happy_hacking

  • If you use this .vimrc suggestion file, it enables vim visual mode, so mouse support is enable on vim.

  • Basic commands in visual mode are :

    • shift+y to copy
    • shift+p to paste
  • Below, suggestion for file .vimrc ...

""" read first from this file
""" from " Website: https://github.com/yorickpeterse/happy_hacking.vim
"colorscheme happy_hacking
colorscheme yozakura

""" then apply personalisations
filetype off

"highlight clear

filetype plugin indent on " Filetype auto-detection
syntax on " Syntax highlighting

"set background=dark


""" set UTF-8 encoding
set encoding=utf-8
set fenc=utf-8
set termencoding=utf-8
""" disable vi compatibility (emulation of old bugs)
set nocompatible
""" use indentation of previous line
set autoindent
""" use intelligent indentation for C
"set smartindent
""" configure tabwidth and insert spaces instead of tabs
set tabstop=4        " tab width is 4 spaces
set shiftwidth=4     " indent also with 4 spaces
set expandtab        " expand tabs to spaces
""" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
set textwidth=120
""" turn syntax highlighting on
set t_Co=256
"syntax on
""" colorscheme wombat256
""" turn line numbers on
set number
""" highlight matching braces
set showmatch
""" intelligent comments

set softtabstop=4
set showcmd
set showmatch
set incsearch
set hlsearch

set hidden

"if has('termguicolors')
"    set termguicolors
"endif

set mouse=a

""" https://gist.github.com/benjiao/08432d1377e768c2c4e9

" Use case insesitive search
set ignorecase
set smartcase

" Display cursor position
set ruler

" Prompt to save file on exit
set confirm

" Disable beep
set visualbell

" Highlight cursor line
set cursorline