If you are a
https://github.com/vinta/awesome-python
#python #reference #github #awesome_python
Python
programmer and need a reference to almost every useful python package, take look at the below repo in github
:https://github.com/vinta/awesome-python
#python #reference #github #awesome_python
GitHub
GitHub - vinta/awesome-python: An opinionated list of awesome Python frameworks, libraries, software and resources.
An opinionated list of awesome Python frameworks, libraries, software and resources. - vinta/awesome-python
urlparse
library is used in python
in order to well, parse a URL.Consider the example below:
from urlparse import urlparse
google_url = urlparse('https://www.google.com/profile?active=true#comment')
google_url
is now of type ParseResult
class, which includes all data we need:The protocol used in URL is achievable by:
print url.scheme
'https'
Absolute url of the google url is retrieved by
netloc
:print url.netloc
'www.google.com'
The path section of the URL which is after the domain section is:
print url.path
'/profile'
Query section of the URL:
print url.query
'active=true'
The
fragment
part of url is stored in fragment
attribute:print url.fragment
'comment'
#python #urlparse #url
watch
linux command is used to run a command at regular intervals.The command below is the simplest form of watch:
watch YOUR_COMMAND
For instance:
watch df -h
The command above runs
df -h
(check disk space) every 2 seconds by default.In order to change the interval:
watch -n 5 df -h
-n
or --interval
specify update interval in second. The command will not allow quicker than 0.1 second interval.In case you want to see the differences in your output command use
-d
or --differences
. It wil highlightwhen part of your command output changes. For example in our command if disk space usage changes we will see
the new result highlighted.
SIDE NOTE:
-h
in df
command will show a human readable format of disk space in mega byte.#linux #sysadmin #watch
Tech C**P
watch linux command is used to run a command at regular intervals. The command below is the simplest form of watch: watch YOUR_COMMAND For instance: watch df -h The command above runs df -h (check disk space) every 2 seconds by default. In order to…
minimum interval of
http://procps.cvs.sourceforge.net/viewvc/procps/procps/watch.c?view=markup
0.1
is hardcoded in the source code of watch
command in the link below line 171
:http://procps.cvs.sourceforge.net/viewvc/procps/procps/watch.c?view=markup
procps.cvs.sourceforge.net
SourceForge.net Repository - [procps] Contents of /procps/watch.c
The world's largest development and download repository of Open Source code and applications
Thousand separator using
#python #format #thousand_separator
format
in python
:your_number = 35200000
print '{:,}'.format(your_number)
#python #format #thousand_separator
A comprehensive management system for Apache Kafka®
https://www.confluent.io/product/control-center/
#kafka #confluent #monitoring
https://www.confluent.io/product/control-center/
#kafka #confluent #monitoring
If you want to run a script,
In a regular whay when you try to run a python script you would use:
Anything that will be printed inside of the script will be printed out into the stdout, so you use the below code to put the script output (stdout) into a file:
The above command will put the output into a persisted file that can be referenced in the future.
you are in a hurry and just want to put output in a file. Logging solution is definitely a good s
olution.
Finally if you want to run the script in background use:
ays that send
#linux #python #script #log
ALWAYS
log script output into a file or you will be bitten in the ass and would not have any log data for future reference.In a regular whay when you try to run a python script you would use:
python my_script.py
Anything that will be printed inside of the script will be printed out into the stdout, so you use the below code to put the script output (stdout) into a file:
python my_script.py >> my_script.log
The above command will put the output into a persisted file that can be referenced in the future.
NOTE:
The above scenario is for cases when you don't use a log handler in your script, or whenyou are in a hurry and just want to put output in a file. Logging solution is definitely a good s
olution.
Finally if you want to run the script in background use:
python my_script.py >> my_script.log 2>&1
2>&1
: 1 is for stdin and 2 is for stderr( if exist code of non-success happens). This command says that send
stderr
messages into stdout
.#linux #python #script #log
You can open new tabs in
At the top of the vim you would see
name. Now in order to navigate between tabs you can use the below command when your
To go to the previous tab use:
#vim #tab #multi_window #gt #tabe #tips
vim
using tabe
command::tabe
At the top of the vim you would see
[No Name]
which refers to the current filename. Now in order to navigate between tabs you can use the below command when your
vim
is in command mode
:gt
To go to the previous tab use:
gT
#vim #tab #multi_window #gt #tabe #tips
https://stackoverflow.com/questions/32461229/why-use-redux-over-facebook-flux
#react #reactjs #flux #redux
#react #reactjs #flux #redux
Stack Overflow
Why use Redux over Facebook Flux?
I've read this answer, reducing boilerplate, looked at few GitHub examples and even tried redux a little bit (todo apps).
As I understand, official redux doc motivations provide pros comparing to
As I understand, official redux doc motivations provide pros comparing to
Is learning a new language hard?
The answer is yes and no. It's a bit like writing. Everybody can learn how to write, and you can too. But what if you wanted ro become a poet? Then writing alone is not enough. You need to learn the rythm 🎼
The answer is yes and no. It's a bit like writing. Everybody can learn how to write, and you can too. But what if you wanted ro become a poet? Then writing alone is not enough. You need to learn the rythm 🎼
What are
#linux #grep #cat #zcat #command
cat
and zcat
commands and what is their differences?cat
is used to print the content of a file (in stdout or a file, etc). It's main usage is when you want to search something in the whole file like a log file:sudo cat /var/log/nginx/access.log | grep --color "SOMETHING TO SEARCH"
zcat
command on the other is used to get the content of a .gz
compressed text file like apache.log.1.gz
:sudo zcat /var/log/apache/apache.log.1.gz | grep --color "SOMETHING TO SEARCH"
NOTE:
grep command is used to search in a file. the symbol | (pipeline)
is used to send (pipe) first command result into the second command.#linux #grep #cat #zcat #command
Some useful
#python #pip #list #freeze #show #info #search
pip
(python package manager) command:show
: used to know specific information about a module installed on your system:$ pip show requests
Name: requests
Version: 2.13.0
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.com
License: Apache 2.0
Location: /Library/Python/2.7/site-packages
Requires:
search
: used to search a python package on pypi.python.org
:$ pip search "suds"
suds-aop (0.6.1) - Lightweight SOAP client (aop's fork)
...
...
...
NOTE:
the above list is truncated.list
: list installed packages.pip list
NOTE:
you can grep on pip list
to see if a specific package is installed or check its version:pip list | grep "requests"
freeze
: this command does the the same task as list
, but its output can be placed inside of the requirements.txt
.uninstall
: remove a package from your system:pip uninstall requests
#python #pip #list #freeze #show #info #search
Some magic about
Type
These are called
#pycharm #trick #postfix #auto_completion #postfix_completion
PyCharm
:Type
a.if
in a .py
file and press tab, the final result would be:if a:
a.ifn
:if a is None:
a.ifnn
:if a is not None:
app.run().main
if __name__ == '__main__':
app.run()
These are called
postfix completion
and helps programmers to not go back and forth when coding. You can see the complete list in PyCharm
setting.#pycharm #trick #postfix #auto_completion #postfix_completion
طراحی سایت با لوگین و قابلیت پرداخت برای فروش و دانلود Object 3D
جهت تماس با کارفرما لطفا با شناسه زیر ارتباط بگیرید:
@amir3dsmax
#job #project
جهت تماس با کارفرما لطفا با شناسه زیر ارتباط بگیرید:
@amir3dsmax
#job #project
Some useful
List stacks or apps
Run the specified Compose file
List running services associated with an app
List tasks associated with an app
Inspect task or container
List container IDs
Tear down an application
Take down a single node swarm from the manager
#docker #cheatsheet #inspect #stack #swarm #service
docker
commands:docker stack ls
List stacks or apps
docker stack deploy -c <composefile> <appname>
Run the specified Compose file
docker service ls
List running services associated with an app
docker service ps <service>
List tasks associated with an app
docker inspect <task or container>
Inspect task or container
docker container ls -q
List container IDs
docker stack rm <appname>
Tear down an application
docker swarm leave --force
Take down a single node swarm from the manager
#docker #cheatsheet #inspect #stack #swarm #service
Tech C**P
Photo
The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.
#docker #docker_cli #docker_rest #architecture
#docker #docker_cli #docker_rest #architecture
To change a password on behalf of a user in
It will prompt for the password and then prompt to retype the password. The password will be change as soon as you enter
#linux #passwd #change_password
Linux
, first sign on or "su" to the "root" account. Then type:passwd user
It will prompt for the password and then prompt to retype the password. The password will be change as soon as you enter
retype password
.#linux #passwd #change_password