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
FROM python:3.4 | |
ENV PYTHONUNBUFFERED 1 | |
RUN mkdir -p /code | |
WORKDIR /code | |
ADD requirements.txt /code/ | |
RUN pip install -r requirements.txt | |
ADD . /code/ |
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 requests | |
url="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | |
#headers = {'content-type': 'application/soap+xml'} | |
headers = {'content-type': 'text/xml'} | |
body = """<?xml version="1.0" encoding="UTF-8"?> | |
<SOAP-ENV:Envelope xmlns:ns0="http://ws.cdyne.com/WeatherWS/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> | |
<SOAP-ENV:Header/> | |
<ns1:Body><ns0:GetWeatherInformation/></ns1:Body> | |
</SOAP-ENV:Envelope>""" |
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 | |
DOCUMENTATION = ''' | |
--- | |
module: github_repo | |
short_description: Manage your repos on Github | |
''' | |
EXAMPLES = ''' | |
- name: Create a github Repo |
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
# start / stop / restart / status | |
systemctl start test | |
systemctl stop test | |
systemctl restart test | |
systemctl status test | |
# logs use journalctl: | |
# tail the logs for unit `django` | |
journalctl -f -u django |
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
from django import template | |
from django.conf import settings | |
from random import choice | |
register = template.Library() | |
#usage: {{explamation}}! A fun exclamation filter for django | |
@register.filter(name="exclamation") | |
def exclamation(punctuation): | |
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
from suds.client import Client | |
url="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | |
client = Client(url) | |
print client ## shows the details of this service | |
result = client.service.GetWeatherInformation() | |
print result ## see: restult.txt below |
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
imagekit_private_key = '..' | |
base = 'https://api.imagekit.io/v1' | |
# files = {"file": result.content} # example from a url | |
files = {"file": open('/some/file.png', 'rb')} # from a local file | |
data = { | |
"fileName": "my-file.png", | |
"tags": "foo,bar,baz", | |
"folder": "/remote/file/path/" | |
} |
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 PyPDF2 | |
import io | |
from weasyprint import HTML | |
password = 'foo' | |
url = "https://google.com" | |
pdf = HTML(url).write_pdf() | |
in_file = io.BytesIO(pdf) | |
out_file = open('google.pdf', 'wb') |
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
// key to use for get/set state: | |
export const LOCALSTORAGE_KEY = '..' | |
// as an action: | |
export const PERSIST_ACTION = ({ rootState }) => { | |
let stateAsString = JSON.stringify(rootState) | |
window.localStorage.setItem(LOCALSTORAGE_KEY, stateAsString) | |
} | |
// restore a cached vuex store: |
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
window.matchMedia('(prefers-color-scheme: dark)').matches |
NewerOlder