This guide uses the domain your-domain.tld
and its www.
prefixed version.
It starts the rocket application on 127.0.0.1:1337
and as the user www-data
. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.
Python docstrings can be written following several formats as the other posts showed. However the default Sphinx docstring format was not mentioned and is based on reStructuredText (reST). You can get some information about the main formats in that tuto.
Note that the reST is recommended by the PEP 287
There follows the main used formats for docstrings.
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
#!/bin/bash | |
# Run like so: | |
# docker-mongodump <mongo container name> <path to backups> | |
MONGO_CONTAINER=$1 | |
BACKUPS_PATH=$2 | |
DAY=`/bin/date +%Y%m%d` | |
PAST_DAY=`/bin/date -d '3 days ago' +%Y%m%d` |
docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql
- This will generate a
dump.sql
file in your host machine. Awesome, eh? - Avoid using
--compact
on your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use--force
to fix this scenario: recreate your dump without--compact
¯_(ツ)_/¯
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 Foundation | |
import CoreData | |
class CoreDataManager { | |
// MARK: - Core Data stack | |
static let sharedInstance = CoreDataManager() | |
private lazy var applicationDocumentsDirectory: URL = { | |
// The directory the application uses to store the Core Data store file. This code uses a directory named in the application's documents Application Support directory. | |
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) |
The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.
The correct way of creating a private frok by duplicating the repo is documented here.
For this assignment the commands are:
- Create a bare clone of the repository.
(This is temporary and will be removed so just do it wherever.)
git clone --bare [email protected]:usi-systems/easytrace.git
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
filename=`basename "$1"` | |
[[ "$filename" == "Archive" ]] && exit 1 | |
target=`stat -f '%Sc' -t '%Y-%m' "$1"` | |
fullpath="$HOME/Desktop/Archive/$target" | |
mkdir -p "$fullpath" | |
mv "$1" "$fullpath/" | |
script="display notification \"$filename -> Archive/$target\" with title \"Desktop file archived\"" | |
osascript -e "$script" |
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/env python3 | |
# | |
# This is a simple script to encrypt a message using AES | |
# with CBC mode in Python 3. | |
# Before running it, you must install pycryptodome: | |
# | |
# $ python -m pip install PyCryptodome | |
# | |
# Author.: José Lopes | |
# Date...: 2019-06-14 |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<title>Auto play html audio in iOS WeChat InAppBrowser the right way</title> | |
</head> | |
<body> | |
<h1>在 iOS 微信浏览器中自动播放 HTML5 audio(音乐) 的正确方式</h1> | |
<p>核心原理: 在微信的JS-API 中 play 一下 audio 即可达到自动播放的目的(应该是微信自己做了处理)</p> |
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
#!/bin/bash | |
usage() { | |
echo "Usage $0 -c mongo_docker_container_name" | |
} | |
while [[ $# > 1 ]] | |
do | |
key="$1" |