- lxml - Pythonic binding for the C libraries libxml2 and libxslt.
- boto - Python interface to Amazon Web Services
- Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
- PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
- Celery - Task queue to distribute work across threads or machines.
- pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 itertools | |
from functools import reduce | |
l = [[1,2,3],[4,5,6],[7],[8,9]]*99 | |
#(1) | |
list(itertools.chain.from_iterable(l)) | |
#(2) | |
reduce(lambda x,y: x+y, l) |
This file contains 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 os | |
x = os.listdir('.') #list of files in current dir | |
for i in x: | |
if os.path.isdir(i): | |
print i, 'is dir' | |
if os.path.isfile(i): | |
print i, 'is file' |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import hashlib | |
def generate_file_md5(rootdir, filename, blocksize=2**20): | |
m = hashlib.md5() | |
with open( os.path.join(rootdir, filename) , "rb" ) as f: |
This file has been truncated, but you can view the full file.
This file contains 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
Running the Django 1.8 faked migrations | |
2016-09-06 08:44:47,057 INFO 2239 [dd.dogapi] dog_stats_api.py:66 - Initializing dog api to use statsd: localhost, 8125 | |
System check identified some issues: | |
WARNINGS: | |
wiki.ArticleRevision.ip_address: (fields.W900) IPAddressField has been deprecated. Support for it (except in historical migrations) will be removed in Django 1.9. | |
HINT: Use GenericIPAddressField instead. | |
Operations to perform: | |
Synchronize unmigrated apps: eventtracking_django, links, djcelery, discussion_api, edxnotes, auth_exchange, service_status, sekizai, rest_framework, edxmako, openassessment, datadog, staticbook, common_views, course_wiki, support, open_ended_grading, course_structure_api, django_countries, humanize, course_blocks, provider, static_replace, notification_prefs, thumbnail, xblock, mptt, staticfiles, microsite_configuration, markdownedx, fileupload, edx_sga, edx_jsme, monitoring, instructor, static_template_view, corsheaders, pipeline, simple_history, enrollment, messages, config_mo |
This file contains 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
# zeep needs to be installed | |
from zeep import Client, helpers | |
from zeep.wsse.username import UsernameToken | |
# We use google weather's WSDL to test our script | |
client = Client('https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl') | |
# the request to the web service will be sent with the zipCodeList argument (we give the value 90210 to the zipcode argument) | |
req = {"zipCodeList": 90210} | |
# the response from calling the LatLonListZipCode method (give zipcode to get lat and lon) | |
resp = client.service.LatLonListZipCode(**req) |
This file contains 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
''' | |
Let's suppose the external file `template.txt` contains the text: | |
`Hello $name, how are you today?` | |
''' | |
# import Template | |
from string import Template | |
# Open external file | |
file = open('template.txt') |
This file contains 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
============================================== | |
Stopping any existing platform | |
============================================== | |
docker compose -f /home/user/.local/share/tutor/env/local/docker-compose.yml -f /home/user/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/user/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local stop | |
[+] Running 18/0 | |
⠿ Container tutor_local-caddy-1 Stopped 0.0s | |
⠿ Container tutor_local-mysql-permissions-1 Stopped 0 |
This file contains 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
============================================== | |
Stopping any existing platform | |
============================================== | |
docker compose -f /home/user/.local/share/tutor/env/local/docker-co |
OlderNewer