This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove container | |
docker rm -f c52306aaa82e | |
# run | |
docker run --name local-mysql -e MYSQL_ROOT_PASSWORD=password -itd mysql:latest | |
# execute | |
docker exec -it testxxx bash | |
# delete none images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conditional Expressions https://docs.djangoproject.com/en/1.11/ref/models/conditional-expressions/ | |
# QuerySet API https://docs.djangoproject.com/en/1.11/ref/models/querysets/ | |
# OR 查询 | |
from django.db.models import Q | |
Contact.objects.filter(Q(last_name__icontains=request.POST['query']) | | |
Q(first_name__icontains=request.POST['query'])) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete ^none image | |
docker rmi $(docker images | grep "^<none>" | awk '{print $3}') | |
➜ ~ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
test latest 153f83a4d28f 3 minutes ago 935MB | |
<none> <none> 780c3cd2f334 10 minutes ago 934MB | |
<none> <none> b9e62dde27c7 29 minutes ago 934MB | |
<none> <none> 33629fbd9790 About an hour ago 934MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install ping | |
apt-get update | |
apt-get install iputils-ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pull | |
docker pull redis | |
# run | |
docker run --name local-redis -itd redis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pull | |
docker pull mysql | |
# run | |
docker run --name local-mysql -e MYSQL_ROOT_PASSWORD=password -itd mysql:latest | |
# enter | |
docker exec -it local-mysql bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pull image from docker hub | |
docker pull nginx | |
# run image | |
docker run --name local-nginx -p 8080:80 -itd nginx:latest | |
# enter image | |
docker exec -it local-nginx bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
auth_user = 'imUser' | |
auth_password = 'imPassword' | |
proxy_host = '127.0.0.1' | |
proxy_port = '8888' | |
proxies = { | |
'all': f'http://{auth_user}:{auth_password}@{proxy_host}:{proxy_port}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pysock | |
import socket | |
import socks | |
import requests | |
proxy_host = '127.0.0.1' | |
proxy_port = 1080 | |
auth_user = 'imUser' | |
auth_password = 'imPassword' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urlencode | |
url = 'https://www.example.com' | |
params = { | |
'param1': 'p1', | |
'param2': 'p2' | |
} | |
url = f'{url}?{urlencode(params)}' |