python3-merry-christmas
Python 3 prints Merry Christmas Everyone!
Merry Christmas with Python3 script
var="Merry Christmas Everyone!"
print (var)
Python 3 prints Merry Christmas Everyone!
Merry Christmas with Python3 script
var="Merry Christmas Everyone!"
print (var)
So, I want to list the packages installed with pip3
and now that I can see them, I want to update them all.
pip3
installed packagespip3 list
with a for loop
you can loop through all your packages, exclude what is not a package and run the command pip3 {package} --upgrade
on the installed packages.
for n in $(pip3 list | awk '{print $1}' | egrep -v 'Package|^-'); do
pip3 install --upgrade ${n} ;
done
Just another way of doing it.
for package in $(pip list -o | cut -f 1 -d ' ' | tail -n +3); do pip install --upgrade ${package}; done
If you know a better way, do let me know! :)
Beware of dependencies packages or minimum and max versions.
Use at your own responsibility.
Happy learning,
Antonio Feijao
DecSecOps in your company DNA
Github git
basic commands
Some basic git command and working with ssh keys to update the repository
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
ssh-keygen -b 4096
.pub
key into your repositoryTransform to run as a router and NAT device
Finally! This project is now documented here - https://antonio.cloud/projects/linux/raspberry-pi/raspberry-pi-router-access-point-dns-block-ads-vpn/
Important
Below are notes from my old post
## the command below required sudo
echo "-----------------------"
echo "Shows the configs before changes..."
sysctl net.ipv4.ip_forward net.ipv4.conf.eth0.send_redirects
iptables -n -t nat -L POSTROUTING
echo "-----------------------"
echo "Enabling IPv4 routing packets forward..."
sysctl -q -w net.ipv4.ip_forward=1 net.ipv4.conf.eth0.send_redirects=0
echo "-----------------------"
echo "Enabling routing/PAT with ip tables..."
iptables -t nat -C POSTROUTING -o eth0 -j MASQUERADE 2> /dev/null || iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo "-----------------------"
echo "Show configs after changes..."
sysctl net.ipv4.ip_forward net.ipv4.conf.eth0.send_redirects
iptables -n -t nat -L POSTROUTING
echo "-----------------------"
echo "Routing/NAT configuration completed "
A quick and simple way to start a webserver on the current directory with Python 3
using module http.server
{% highlight bash linenos %}
python3 -m http.server 8000 --directory .`
{% endhighlight %}
Happy learning and keep practicing!
Linux find command
Warning
Use the flag -exec
with care.
Try the command find without the -exec rm {} \;
to see which files are found,
find . -type f -name 'desktop.ini' -exec rm {} \;
find . -type f -name '.DS_Store' -exec rm {} \;
Linux Clam AntiVirus ClamAV
clamav's logo
Runs on AmazonLinux, Linux RedHat, Ubuntu, MacOS, Raspberry Pi, ...
MacOS - brew install clamav
RaspberryPi Ubuntu - apt-get install clamav
AmazonLinux, RedHat, CentOS, Fedora - yum install clamav
## updates anti-virus database engine
freshclam -v
## executes the scan-antivirus, -->> ATTENTION to the `--remove` flag, this deletes files!
##
# consider running the command first without the `--remove` flag.
sudo clamscan --infected --remove --recursive=yes .
sudo
- run the command as superuser or rootclamscan
- runs the ClamAV scanner-v
- run in verbose mode--infected
- only output infected files (unless you also specified the verbose)--remove
- removes (deletes) infected detected filesuse man freshclam
or man clamscan
for the official command line manual.
vim and forgot to sudo and now?
vim
forgot to sudo
Forgot to sudo vim
before opening the file and now cannot save the file within vim.
Here is the solution:
:w !sudo tee %
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